TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ribarm on April 10, 2018, 04:40:58 AM
-
Hi to all,
I have a question regarding ROTATE command... When I use that command and firstly specify angle, the next time I run it again CAD prompts last used value informing me that I can repeat last input automatically... The problem is when I use some random mouse clicked rotation angle, the angle next time shows up, but rounded to 8 digits and I've checked real angle is at 15 digits precision... So the question - how can I retrieve that angle or how can I force displaying at 15 decimal digits... Either answer is welcomed - right now as it is it is programmed at 8 digits :
Command: ROTATE
Current positive angle in UCS: ANGDIR=counterclockwise ANGBASE=0.00000000
Select objects: Specify opposite corner: 1 found
Select objects:
Specify base point: _endp of
Specify rotation angle or [Copy/Reference] <45.00000000>:
-
You may have to write your own rotate so it displays correct dec places, you could define the "rotate" command to run your lisp. Like wise can undefine.
-
AUPREC sys var is controlling precision I am looking for - just it can be above 8 digits...
-
So the question - how can I retrieve that angle
(getvar "LASTANGLE")
-
What I did was something like this :
(defun c:ro
( / ss bp ch pp p1 p2
) ; *a* is global variable (setq ch
(getkword (strcat "\nSpecify rotation angle or [Copy/Reference/Both] - ENTER (no option keyword) " (if (null *a
*) ": " (strcat "<" *a
* "> : "))))) (vl-cmdf "_.ROTATE" ss
"" "_non" bp
) )
(setq ch
(getkword "\nRotate with default angle [Yes/No] <Yes> : ")) )
(vl-cmdf "_.ROTATE" ss
"" "_non" bp
*a
*) (vl-cmdf "_.ROTATE" ss
"" "_non" bp
) )
)
)
(vl-cmdf "_.ROTATE" ss
"" "_non" bp
"_C") )
( (and (= ch
"Copy") *a
*) (setq ch
(getkword "\nRotate copy with default angle [Yes/No] <Yes> : ")) )
(vl-cmdf "_.ROTATE" ss
"" "_non" bp
"_C" *a
*) (vl-cmdf "_.ROTATE" ss
"" "_non" bp
"_C") )
)
)
( (= ch "Reference")
(setq p1
(getpoint bp
"\nPick or specify start reference point : ")) (vl-cmdf "_.ROTATE" ss
"" "_non" bp
"_R" "_non" bp
"_non" p1
) )
( (= ch "Both")
(setq p1
(getpoint bp
"\nPick or specify start reference point : ")) (vl-cmdf "_.ROTATE" ss
"" "_non" bp
"_C" "_R" "_non" bp
"_non" p1
) )
)
(if (= "Yes" (getkword "\nDo you want to nil *a* variable - i.e. start rotate command next time without default angle [Yes/No] <No> : ")) )
)
)
)
(defun c:roo
( / ss bp
) ; rotate opposite ; *a* is global variable )
)
)
But not sure, haven't checked for (getvar 'lastangle) as VovKa suggested...
-
(getvar "LASTANGLE")
I think this variable is for some other purposes.