Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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)

Posted

Thanks everyone. It worked.

The mistake was mine, my question was a little childish, I have not applied correctly in my attempts "trans"

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