bbb120 Posted December 16, 2009 Posted December 16, 2009 I want to pick a group of points with a crossing window and export all points coordinates in txt or excel format ,how can I achieve this ?I want to find an easy method to achieve this .who can help me ?my native language is not English . Quote
bbb120 Posted December 16, 2009 Author Posted December 16, 2009 my version of AutoCAD is 2006,who can give me a LISP file which can achieve my goal ? Quote
Lee Mac Posted December 16, 2009 Posted December 16, 2009 Only made this a few days ago... http://www.cadtutor.net/forum/showthread.php?t=42954 Quote
bbb120 Posted December 16, 2009 Author Posted December 16, 2009 Only made this a few days ago... http://www.cadtutor.net/forum/showthread.php?t=42954 the lisp file seems does not satisfy my require ,because it cannot select the points on the line.maybe you need to give me a simple tutorial or other ? Quote
Lee Mac Posted December 16, 2009 Posted December 16, 2009 the lisp file seems does not satisfy my require ,because it cannot select the points on the line.maybe you need to give me a simple tutorial or other ? I assume you are talking about ACAD points? In the program, select the input as "Point", and the output as "File" (and select your file). If you just click OK, it will extract ALL the points in the drawing, but if you click on the ">>" symbol, you can pick the points you want to extract. If you are still stuck, just ask. Lee Quote
bbb120 Posted December 16, 2009 Author Posted December 16, 2009 I assume you are talking about ACAD points? In the program, select the input as "Point", and the output as "File" (and select your file). If you just click OK, it will extract ALL the points in the drawing, but if you click on the ">>" symbol, you can pick the points you want to extract. If you are still stuck, just ask. Lee I mean that it cannot pick the line end points,I want to pick all the line end points.I do not know whether you understand my words ,my native language is not English ,so maybe you misunderstood my words.Does your program can pick the line end points ? Quote
Tiger Posted December 16, 2009 Posted December 16, 2009 I mean that it cannot pick the line end points,I want to pick all the line end points.I do not know whether you understand my words ,my native language is not English ,so maybe you misunderstood my words.Does your program can pick the line end points ? I suspect the confusion here is that there is such a thing as a Point in AutoCAD, that is just a Point. Those are the points that LeeMac's Lisp can extract from your drawing. You can add points with the command POINT (or Draw > Point). And what you are after BBB is to get the coordinates of start and end of a Line/Polyline? Quote
bbb120 Posted December 16, 2009 Author Posted December 16, 2009 not only endpoint ,but also startpoint ,I want to pick both of them ! Quote
bbb120 Posted December 16, 2009 Author Posted December 16, 2009 pick startpoints,endpoints and point which are drawed by the command "point ",pick all of them :startpoints endpoints point Quote
Tiger Posted December 16, 2009 Posted December 16, 2009 pick startpoints,endpoints and point which are drawed by the command "point ",pick all of them :startpoints endpoints point wait a second, you do have Points now? Not Lines? If you have Points, you can use LeeMacs Lisp, if you have Lines, that won't work. And btw, where are you from? you say that English is not your native language, we might be able to communicate in another language? Quote
Lee Mac Posted December 16, 2009 Posted December 16, 2009 not only endpoint ,but also startpoint ,I want to pick both of them ! Ahh - I understand now - as Tiger explains, I was under the impression you meant ACAD Points. The program I have recommended will currently only extract Points and 2D/3D Polyline Vertices, but it seems natural that I should update it to include lines also :wink: In the mean time: (defun c:getlines (/ dxfs strmke DEL ENT F I PTS SS X) (vl-load-com) (defun dxfs (code ent) (mapcar 'rtos (cdr (assoc code (entget ent))))) (defun StrMke (lst chrc / str) (setq str "") (while (setq x (car lst)) (setq str (strcat str x (chr chrc)) lst (cdr lst))) (vl-string-right-trim (chr chrc) str)) (if (and (setq i -1 ss (ssget '((0 . "LINE")))) (setq f (getfiled "Output File" "" "txt;csv" 9))) (progn (setq del (if (eq ".TXT" (strcase (vl-filename-extension f))) 32 44) f (open f "a")) (while (setq ent (ssname ss (setq i (1+ i)))) (setq pts (mapcar (function dxfs) '(10 11) (list ent ent))) (mapcar (function (lambda (x) (write-line (StrMke x del) f))) pts) (write-line "" f)) (close f))) (princ)) Quote
bbb120 Posted December 16, 2009 Author Posted December 16, 2009 I assume you are talking about ACAD points? In the program, select the input as "Point", and the output as "File" (and select your file). If you just click OK, it will extract ALL the points in the drawing, but if you click on the ">>" symbol, you can pick the points you want to extract. If you are still stuck, just ask. Lee Can your LISP file pick points which are drawed by the command POINT and the line endpoints and startpoints ? Quote
Lee Mac Posted December 16, 2009 Posted December 16, 2009 Can your LISP file pick points which are drawed by the command POINT and the line endpoints and startpoints ? Currently, it will only extract Points and the Vertices of 2D/3D polylines. Quote
bbb120 Posted December 16, 2009 Author Posted December 16, 2009 Ahh - I understand now - as Tiger explains, I was under the impression you meant ACAD Points. The program I have recommended will currently only extract Points and 2D/3D Polyline Vertices, but it seems natural that I should update it to include lines also :wink: In the mean time: (defun c:getlines (/ dxfs strmke DEL ENT F I PTS SS X) (vl-load-com) (defun dxfs (code ent) (mapcar 'rtos (cdr (assoc code (entget ent))))) (defun StrMke (lst chrc / str) (setq str "") (while (setq x (car lst)) (setq str (strcat str x (chr chrc)) lst (cdr lst))) (vl-string-right-trim (chr chrc) str)) (if (and (setq i -1 ss (ssget '((0 . "LINE")))) (setq f (getfiled "Output File" "" "txt;csv" 9))) (progn (setq del (if (eq ".TXT" (strcase (vl-filename-extension f))) 32 44) f (open f "a")) (while (setq ent (ssname ss (setq i (1+ i)))) (setq pts (mapcar (function dxfs) '(10 11) (list ent ent))) (mapcar (function (lambda (x) (write-line (StrMke x del) f))) pts) (write-line "" f)) (close f))) (princ)) there are something wrong with your code ,I draw a rectangular with LINE command ,first point (0,0) then (600,0),(600,400),(0,400) but I get results by the command getlines which is provided by your code get ten coordinates ,they are: 0 400 0 0 0 0 600 400 0 0 400 0 600 0 0 600 400 0 0 0 0 600 0 0 0 400 0 0 0 0 I only need four results ,because I want to import the four points by ansys ! Quote
bbb120 Posted December 16, 2009 Author Posted December 16, 2009 Maybe it will help your code cannot work on my computer,my AutoCAD 2006 is Chinese version ,It only can accept Chinese and English , maybe you can translate your code into English ,then your code maybe used by the people around the world who like me whose AutoCAD can only accept English command ! Quote
Lee Mac Posted December 16, 2009 Posted December 16, 2009 there are something wrong with your code ,I draw a rectangular with LINE command ,first point (0,0) then (600,0),(600,400),(0,400)but I get results by the command getlines which is provided by your code get ten coordinates ,they are: 0 400 0 0 0 0 600 400 0 0 400 0 600 0 0 600 400 0 0 0 0 600 0 0 0 400 0 0 0 0 I only need four results ,because I want to import the four points by ansys ! I seem to get the correct results 0.0000 400.0000 0.0000 0.0000 0.0000 0.0000 600.0000 400.0000 0.0000 0.0000 400.0000 0.0000 600.0000 0.0000 0.0000 600.0000 400.0000 0.0000 0.0000 0.0000 0.0000 600.0000 0.0000 0.0000 Quote
eldon Posted December 16, 2009 Posted December 16, 2009 there are something wrong with your code ,I draw a rectangular with LINE command ,first point (0,0) then (600,0),(600,400),(0,400) I think you will find that the code is working perfectly, but you are not using it properly. If you draw a rectangle with four lines, you will have coordinates for each end of the four lines, i.e. eight coordinates. If you look harder, you probably have drawn the line from 0,400 to 0,0 twice, so you have five lines drawn. The code is absolutely correct. Now if you draw the rectangle with a polyline, you would get the answer that you wanted. Or even draw the rectangle with the Rectangle command. Quote
bbb120 Posted December 16, 2009 Author Posted December 16, 2009 I seem to get the correct results but (600,400,0)twice,(0,0,0) three times ETC ,I only want to only one time, one point one time,union set in mathematical language.the same two elements cannot belong to the one set.I think I did not express my ideas exactly ! Quote
Tiger Posted December 16, 2009 Posted December 16, 2009 but (600,400,0)twice,(0,0,0) three times ETC ,I only want to only one time,one point one time,union set in mathematical language.the same two elements cannot belong to the one set.I think I did not express my ideas exactly ! There is a mix of expressions here. You get two identical sets of coordinates for two different entitys because they share start and end point. As eldon said, if you use Polyline or Rectangle command, you get one entity and one set of coordinates. Or, you can add POINTs to eaach point that you want and use Lee Macs original lisp. Also something to think about: I have complete faith in Lee Mac, Eldon or any of the Lisp Gurus here that they can do a lisp that does exactly what you want. But they, like you have a job to do as well, and are helping you because they are friendly souls - with a little gratitude you can come a long way. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.