Jump to content

Getting entity Position XYZ and Rotation XYZ ?


plantdesign

Recommended Posts

Is it possible using LISP or .net to loop through each entity and get it's Position XYZ and rotation XYZ?

 

Thanks!

Link to comment
Share on other sites

Its easy when you entget an object you can pull it apart so simple example is a line you get a start pt and end point its rotation is found by (angle startpt endpt)

 

There are heaps of examples here such as

 

   (setq ss1 (ssget '((0 . "LINE"))))
  (setq n (sslength ss1))
  (setq count 0)
  (repeat n
     (setq en (ssname ss1 count))
     (setq el (entget en))
     (setq count (+ count 1))
     (setq pt1 (cdr (assoc 10 el)))
(princ "\npt1 is ")(princ pt1)
     (setq pt2 (cdr (assoc 11 el)))
(princ "\npt2 is ")(princ pt2)

; your turn do angle here
)
(princ)

 

The next thing is that different objects give different answers a circle & and arc have a centre pt a polyline has lots of pts your question is to simple and needs more detail. look up help dxf codes and you will see all the info available.

 

If you use VL code you can probably get the answer a bit simpler.

Link to comment
Share on other sites

Thanks, BIGAL. Here is what I have. It's a 3D object (cylinder with a bend). I really don't know too much about autolisp but, can I use your code (or something close to it) to extract the position xyz and rotation xyz of this object?

 

Thanks!

 

elbow2_rotation.jpg

Link to comment
Share on other sites

You can get the xyz for the 3dSolid but I do not think you can get the rotation and whatever you mean by that the bend or the rotation of the entity .

 

In VLisp is the one in this case. :)

Link to comment
Share on other sites

Yeah, position is easy. It's rotation that's the ******. And that seems to be the general consensus. Gotta do the matrix3 / transform / vector math with it's insane 16 digits of hell.

 

Thanks :)

Link to comment
Share on other sites

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