kalimero Posted January 13, 2011 Posted January 13, 2011 Please help for the next problem: I'm using Autocad 2005 I have a DWG file with more circles. How can I extract (using lisp) the accurate 3D coordinates of theirs centers (XYZ). For example: (see attached dwg-file) the marked circle has center (60,40,5) But using lisp (entget)… ((-1 . ) (0 . "CIRCLE") (330 . ) (5 . "2E77B") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "2") (48 . 0.25) (100 . "AcDbCircle") (10 40.0 5.0 60.0) (40 . 5.0) (210 1.0 0.0 2.22045e-016)) So, the coordinates of the center are X40; Y5; Z60? How can I get the correct values? Thank you for any help. circles.dwg Quote
David Bethel Posted January 13, 2011 Posted January 13, 2011 If you want the center point in WorldCoordinateSystem ( WCS ), then use the (trans) function If the entity ename is en, then: (trans (cdr (assoc 10 (entget en))) en 0) or (trans (cdr (assoc 10 (entget en))) (cdr (assoc 210 (entget en))) 0) -David Quote
irneb Posted January 13, 2011 Posted January 13, 2011 Uhm yes, David's code should work. Though your DWG's circle lists as: center point, X= 60.0000 Y= 40.0000 Z= [b]10.0000[/b] radius 5.0000 And using David's 1st code sample: Command: (trans (cdr (assoc 10 (entget (setq en (car (entsel)))))) en 0) Select object: (60.0 40.0 10.0) Quote
kalimero Posted January 13, 2011 Author Posted January 13, 2011 Thanks everyone. It worked. The mistake was mine, my question was a little childish, I have not applied correctly in my attempts "trans" 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.