Jump to content

Recommended Posts

Posted

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

 

BRACE.png

  • 2 weeks later...
Posted

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.

  • 2 weeks later...
Posted

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

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