scubastu Posted November 22, 2009 Share Posted November 22, 2009 Maybe a silly question, but how do you get a rotation from a dynamic block? My block has scale and rotation dynamic properties in it. The Rotation shows in the Properties bar as Angle1. How can I retrieve this in lisp? Ultimately I want to realign the rotation of the block to another object I select e.g. line, polyline etc.. Thanks in advance Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 22, 2009 Share Posted November 22, 2009 example: (defun c:test ( / ent ) (vl-load-com) (if (setq ent (car (entsel "\nSelect Block: "))) (mapcar (function (lambda (property) (vlax-get property 'value))) (vlax-invoke (vlax-ename->vla-object ent) 'getDynamicBlockProperties)))) Quote Link to comment Share on other sites More sharing options...
fixo Posted November 22, 2009 Share Posted November 22, 2009 Maybe a silly question, but how do you get a rotation from a dynamic block? My block has scale and rotation dynamic properties in it. The Rotation shows in the Properties bar as Angle1. How can I retrieve this in lisp? Ultimately I want to realign the rotation of the block to another object I select e.g. line, polyline etc.. Thanks in advance I hope this will allow you to change parameters (just one at a time - sorry, not tested) (defun C:cang(/ ang blk blkname cparam props ss) (setq blkname "TestBlock" ;<--change block name here cparam "Angulo");<--change parameter name here (setq ang (getreal "\nEnter angle in degrees: ") ang (/ (* pi ang) 180) ) (if (setq ss (ssget ":S" (list (cons 0 "INSERT") (cons 2 (strcat blkname ",`*U*"))))) (progn (setq blk (vlax-ename->vla-object (ssname ss 0))) (setq props (vlax-safearray->list (variant-value (vla-getdynamicblockproperties blk)))) (foreach param props (if (eq cparam (vla-get-propertyname param)) (vlax-put-property param "Value" (vlax-make-variant ang 5)) (vla-update blk) ) ) ) ) (princ) ) (vl-load-com) ~'J'~ Quote Link to comment Share on other sites More sharing options...
scubastu Posted November 22, 2009 Author Share Posted November 22, 2009 Thanks guys it gives me something to work with! May God bless you with a pay rise! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 22, 2009 Share Posted November 22, 2009 Thanks guys it gives me something to work with! May God bless you with a pay rise! Your welcome 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.