TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: velasquez on June 20, 2009, 07:32:29 AM
-
I have the command Rotate working with the option Reference, see code below.
(command "._rotate" "_l" "" pt1 "_R" 270 45)
In vla-rotate this option doesn't exist.
; Rotate (2)
Somebody can me to say how to calculate the Final angle?
See code below.
(vla-rotate (vlax-ename->vla-object (entlast)) (vlax-3D-Point pt1) 180)
-
Are you asking for angle in Radians?
(/ (* degAngle pi) 180.0)
For 90 deg
(/ (* 90 pi) 180.0)
-
Hi,
The angle you want to calculate is : (360° - R) - A
where R is the Reference angle in degrees and A the new angle in degrees.
But as CAB said vla-Rotate needs angles in radians (as getangle, getorient, angle returned values)
(setq ent (car (entsel))
pt (getpoint "\nBasePoint :")
r (getangle "\nReference angle: ")
a (getangle pt "\nNew angle: ")
)
(vla-rotate
(vlax-ename->vla-object ent)
(vlax-3d-point pt)
(+ (- (* 2 pi) r) a)
)