Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Formula to keep attribute from spinning?

2 REPLIES 2
Reply
Message 1 of 3
Metron4
210 Views, 2 Replies

Formula to keep attribute from spinning?

I am wondering if it is possible to use a lisp variable in the Angle value of a Rotation Parameter attached to an attribute in order to keep it from spinning inside a dynamic block. The reason I am seeking such a complex method is because I want to use an Alignment Parameter to place the block, and the two methods I know of to keep attributes from spinning only work when you rotate the block with a Rotation Parameter.

Since the block has a rotation value after it is aligned, and the Rotation Parameter attached to the attribute has an "Angle" value, I wonder if it is possible to stick a formula or something inside that Angle value that grabs the equation of 360 minus whatever angle the dynamic block is rotated to. That would always give it a number that would orient the Rotation Parameter (and thus the attached attribute) to always be upright.

If I could insert a field in that value box I could select a Field expression for the block and rotation value, but alas, this is not an option.
2 REPLIES 2
Message 2 of 3
Moshe-A
in reply to: Metron4

Metron hi,

well, i'll tell you how would i approch this

1. define a command reactor to monitor command ends.

{code}
; load ActiveX support
(vl-load-com)

; install command reactor
(if (not cmdReactor)
(setq cmdReactor (vlr-command-reactor nil '((:vlr-commandEnded . OnCommandEnded))))
)
{code}

2. in (OnCommandEnded) callback function check if GRIP_STRETCH command
was invoked and grab the griped object

{code}
; callback funtion
(defun OnCommandEnded (objReactor cmdList / ss ent e)
(if (and (eq (car cmdList) "GRIP_STRETCH")
(setq ss (cadr (ssgetfirst)))
)
(progn
(setq ent (ssname ss 0))
(setq e (entget ent))
(if (and (eq (cdr (assoc '0 e)) "INSERT")
(eq (cdr (assoc '2 e)) "YOUR_BLOCK_NAME")
(= (cdr (assoc '66 e)) 1) ; does it contain attributes?
)
(cmd_rotate_attributes ent)
); if
); progn
); if
); defun

(defun cmd_rotate_attributes (ent)
; scan the attributes inside the BlockReference and
; rotate them to be upright
)
{code}

Cheers
Moshe
Message 3 of 3
Metron4
in reply to: Metron4

Thanks for the post. I will have to investigate this further. I should have known it wouldn't be as simple as sticking a formula in the Angle box.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost