plantdesign Posted July 14, 2011 Share Posted July 14, 2011 Is it possible using LISP or .net to loop through each entity and get it's Position XYZ and rotation XYZ? Thanks! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 14, 2011 Share Posted July 14, 2011 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. Quote Link to comment Share on other sites More sharing options...
plantdesign Posted July 14, 2011 Author Share Posted July 14, 2011 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! Quote Link to comment Share on other sites More sharing options...
SLW210 Posted July 14, 2011 Share Posted July 14, 2011 Are you using AutoCAD or 3DS Max? Quote Link to comment Share on other sites More sharing options...
plantdesign Posted July 14, 2011 Author Share Posted July 14, 2011 Autocad Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 14, 2011 Share Posted July 14, 2011 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. Quote Link to comment Share on other sites More sharing options...
plantdesign Posted July 14, 2011 Author Share Posted July 14, 2011 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 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 14, 2011 Share Posted July 14, 2011 Exactly , The position is the xyz for the 3dsolid and what's what I meant . Regards. 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.