RJR Posted December 9, 2021 Share Posted December 9, 2021 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 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 10, 2021 Share Posted December 10, 2021 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. 1 Quote Link to comment Share on other sites More sharing options...
eldon Posted December 10, 2021 Share Posted December 10, 2021 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 1 Quote Link to comment Share on other sites More sharing options...
RJR Posted December 13, 2021 Author Share Posted December 13, 2021 thanks a lot @eldon... that solves my issue Quote Link to comment Share on other sites More sharing options...
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.