TheyCallMeJohn Posted July 26, 2013 Posted July 26, 2013 Hey All, Okay so I have s dynamic block (green in my example) that is built in the x-y plane. I can change its length, width, extend it and rotate it about the base point. Yada yada yada. Bunch of feature that the company I work for needs. When we insert it into a 3D model we position it such that the Y axis becomes the Z axis and the the X axis can be anywhere within the the X-Y plane. I am trying to create a lisp that will move it relative to a second block (red in my example). Does any know a way to get the rotational information for the dynamic blocks. I can't use the "Rotation" from the misc section since it operate in the blocks x-y plane instead of the models x-y plane. I created an image below with Axis. To hopefully clarify. These aren't the actual blocks just example shapes. Hopefully someone can help. I have tried a few things without success. Quote
TheyCallMeJohn Posted August 5, 2013 Author Posted August 5, 2013 Okay after doing some more research, I think I need to get the transformation matrix for each object. This can apparently be obtained using "nentselp" but is there a ways to use this to get a batch of transformation objects for a group of dynamic block entities? Nentselp seems to only accept points for selection. Quote
TheyCallMeJohn Posted August 16, 2013 Author Posted August 16, 2013 In case anyone wants to do something similar... This is a portion of the code I cam came up with. Hopefully it will be helpful to some one in the future. Also do to the way dynamic blocks are configured, what would be the Z axis in the dynamic block editor, become the reference for unit vector that makes up the "normal" value. So I had to rotate the unit vectors by 90 degrees around the z axis. (setq pl_set (ssget '((0 . "INSERT")))) (setq pl_set_lgth (SSLENGTH pl_set)) (setq br_item 0) (repeat pl_set_lgth (setq en (SSNAME pl_set br_item)) (setq entvla (vlax-Ename->Vla-Object en)) (setq unitVec (vlax-get entvla 'normal)) (setq InsrtPnt (vlax-get entvla 'InsertionPoint)) (if (getdynpropvalue entvla "BRCKT_ELEV X") (progn (setq brace_dist (abs (getdynpropvalue entvla "BRCKT_ELEV X"))) (princ "\n unitVec is:") ;to be removed (princ unitVec) ;to be removed (setq i_val (car unitVec)) (setq j_val (cadr unitVec)) (setq i_val_n (* 1.0 j_val)) (setq j_val_n (* -1.0 i_val)) (setq z_rot_rad (atan j_val_n i_val_n)) 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.