Jump to content

How to extract points coordinates quickly ?


Recommended Posts

Posted

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 .

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • bbb120

    11

  • Lee Mac

    5

  • Tiger

    3

  • VVA

    2

Top Posters In This Topic

Posted

my version of AutoCAD is 2006,who can give me a LISP file which can achieve my goal ?

Posted

Only made this a few days ago...

http://www.cadtutor.net/forum/showthread.php?t=42954

Posted
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 ?

Posted
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

Posted
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 ?

Posted
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?

Posted

not only endpoint ,but also startpoint ,I want to pick both of them !

Posted

pick startpoints,endpoints and point which are drawed by the command "point ",pick all of them :startpoints endpoints point

Posted
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?

Posted
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))
     

Posted
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 ?

Posted
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.

Posted
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 !

Posted

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 !

Posted
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 :unsure:

 

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

Posted
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.

Posted
I seem to get the correct results :unsure:

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 !

Posted
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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...