Jump to content

Recommended Posts

Posted

Hi, As part of job, i need to prepare CAD drawings in AutoCAD (typical show in attachment).  I wish to get the coordinates of each line in (x,y).  I can extract the numbers using scripting if the file is saved in DXF format. But for that, i need to know the keyword inside DXF file to get the coordinate of each line (start and end).  I am  attaching the DWG file here.  Thanks.

Drawing.dwg

Posted

Getting all start end of lines is easy using lisp, there are two simple methods available, 1st is as you suggest use (entget  then (assoc 10 is start (assoc 11 is end pt, the 2nd is using VL (vlax-get Obj 'StartPoint) (vlax-get Obj 'EndPoint)

 

If you have a pline again a couple of methods, use co-ordinates or (vlax-curve-getendpoint obj) there is other ways get vertex.

 

Do you know how to process  a selection set created using (ssget and then get start/end as provided. If not just google "get start end points lisp autocad" heaps of examples.

  • Like 1
Posted

If you want to go the DXF route, then first of all make the DXF file.

 

Open it in a text file and look for the word ENTITIES, then all the drawing lines are listed after that in the following format (red text are my comments):-

 

Quote

ENTITIES   Start of entity data listing
  0
LINE          entity name
  5
725
330
1F
100
AcDbEntity
  8
0
 62
     2
100
AcDbLine
 10                                 start of line
34.41069821781404   x coordinate
 20
22.54172444853808   y coordinate
 30
0.0                                 z coordinate
 11                                  end of line
40.41069821781404   x coordinate
 21
22.54172444853808   y coordinate
 31
0.0                                  z coordinate
  0
LINE        next line
  5


 

  • Like 1

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