I've set up a LISP to rotate a block based on the viewtwist, but I'm trying to get it to be at 90 degrees of the current twist. Is there a way modify the viewtwist value number to where it will take the value and then add 90 to it?
|
I've set up a LISP to rotate a block based on the viewtwist, but I'm trying to get it to be at 90 degrees of the current twist. Is there a way modify the viewtwist value number to where it will take the value and then add 90 to it?
Radians:Code:(+ (getvar 'viewtwist) (/ pi 2.))
Thanks, got it. Figured it was something with pi.
Last question regarding this specific lisp I am working on.
Is there a VLA command that will only run a program based on a what is within the current viewport, and not everything in model space?
Code:(defun RotateStationing () (setq staBlockName (mapcar (function strcase) '("fiber marker tube-sta"))) (setq vwPort (+ (- (getvar "viewtwist")) (/ pi 2))) (if (setq ss (ssget "_X" (list '(0 . "INSERT") (cons 2 (apply (function strcat) (cons "`*U*," (mapcar (function (lambda (s) (strcat s ","))) staBlockName))))))) (progn (vlax-for x (setq ss (vla-get-activeselectionset (cond (*ACADdoc*) ((setq *ACADdoc* (vla-get-activeviewport (vlax-get-acad-object))))))) (if (and (vl-position (strcase (vlax-get-property x (if (vlax-property-available-p x 'EffectiveName) 'EffectiveName 'Name))) staBlockName) (eq (vla-get-isDynamicBlock x) :vlax-true)) (vl-some (function (lambda (p) (if (eq (vlax-get-property p "PropertyName") "Stationing Angle") (not (vl-catch-all-error-p (vl-catch-all-apply (function vlax-put-property) (list p "Value" vwPort))))))) (vlax-invoke x 'GetDynamicBlockProperties)))) (vla-delete ss))) (princ) )
I tried modifying this code with vla-get-activeviewport, thinking it would do that, but of course I was wrong.
There is no consistency with that here, so I just took out the "_X" after the SSGET function, and that works perfect since the user can just group select what they want to adjust.
Yeah, but what I meant was that for what we do here, the change I did works great for us.
I'm having issues with this now, in that if a block is rotated an any other angle than 0, it won't rotate it properly. It rotates it at 90 degrees of its inserted angle, and not 90 degrees of the viewport angle.
Maybe it's the trans, but I'm not sure where that would go in the coding.
if any are interested i have a lisp routine that works great in both model space and in a view port. i use this a lot in my view ports it does a dviewtwist in the view port and leave the original layout in model space.
DVTwist isn't what I'm really looking for, but may be useful for others.
Still trying to get this figured out though, since it appears that these blocks rotate based on their insertion angle and not the viewport angle.