Author Topic: Default angle  (Read 1594 times)

0 Members and 1 Guest are viewing this topic.

velasquez

  • Newt
  • Posts: 195
Default angle
« on: February 13, 2016, 01:35:58 PM »
Where is stored the angle of the rotate command?
Specify base point: _MID of
Specify rotation angle or [Copy / Reference] <45>:

hmspe

  • Bull Frog
  • Posts: 362
Re: Default angle
« Reply #1 on: February 13, 2016, 02:43:08 PM »
in the LASTANGLE variable.
"Science is the belief in the ignorance of experts." - Richard Feynman

velasquez

  • Newt
  • Posts: 195
Re: Default angle
« Reply #2 on: February 13, 2016, 03:11:00 PM »
in the LASTANGLE variable.

Thanks for the help HMSP
But the variable LASTANGLE does not store the last angle to rotate command.
I posted the Results below.

Command: _rotate
Current positive angle in UCS:  ANGDIR=counterclockwise  ANGBASE=0
Select objects: 1 found
Select objects:
Specify base point: _mid of
Specify rotation angle or [Copy/Reference] <0>: 90

Command: (getvar "lastangle")
0.0

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: Default angle
« Reply #3 on: February 13, 2016, 05:12:15 PM »
As you already have correct assumption, that value is built-in into ROTATE command and can't be extracted lightly... Perhaps, try this lisp to try to overcome this issue :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:rot-ang ( / ss o ow a str ch el )
  2.   (if
  3.     (and
  4.       (progn (prompt "\nSelect object(s) for rotation on unlocked layer(s)...") t)
  5.       (setq ss (ssget "_:L"))
  6.       (setq o (getpoint "\nPick or specify base point for rotation : "))
  7.       (setq ow (trans o 1 0))
  8.     )
  9.     (progn
  10.       (if (null *a*)
  11.         (progn
  12.           (initget "Copy Reference")
  13.           (setq ch (getkword "\nChoose an option [Copy/Reference] <classic rotate> : "))
  14.           (cond
  15.             ( (eq ch "Copy")
  16.               (setq el (entlast))
  17.               (command "_.COPY" ss "" "_non" '(0.0 0.0 0.0) "_non" '(0.0 0.0 0.0))
  18.               (setq ss (ssadd))
  19.               (while (setq el (entnext el))
  20.                 (ssadd el ss)
  21.               )
  22.               (setq *a* (acet-ss-drag-rotate ss o "\nPick or specify angle for rotation : " t))
  23.               (command "_.ROTATE" ss "" "_non" o (setq *a* (cvunit *a* "radian" "degree")))
  24.             )
  25.             ( (eq ch "Reference")
  26.               (setq a (getangle o "\nPick or specify reference angle : "))
  27.               (command "_.UCS" "_Z" (cvunit a "radian" "degree"))
  28.               (setq *a* (acet-ss-drag-rotate ss (trans ow 0 1) "\nPick or specify angle for rotation : " t))
  29.               (command "_.ROTATE" ss "" "_non" (trans ow 0 1) (setq *a* (cvunit *a* "radian" "degree")))
  30.               (command "_.UCS" "_P")
  31.             )
  32.             ( t
  33.               (setq *a* (acet-ss-drag-rotate ss o "\nPick or specify angle for rotation : " t))
  34.               (command "_.ROTATE" ss "" "_non" o (setq *a* (cvunit *a* "radian" "degree")))
  35.             )
  36.           )
  37.         )
  38.         (progn
  39.           (setq str (getstring (strcat "\nSpecify angle for rotation <" (rtos *a* 2 2) "> : ")))
  40.           (if (eq str "")
  41.             (setq a *a*)
  42.             (setq a (atof str))
  43.           )
  44.           (command "_.ROTATE" ss "" "_non" o a)
  45.           (setq *a* a)
  46.         )
  47.       )
  48.       (initget "Yes No")
  49.       (setq ch (getkword "\nSave last specified angle as global variable *a* [Yes/No] <No> : "))
  50.       (if (not (eq ch "Yes"))
  51.         (setq *a* nil)
  52.       )
  53.     )
  54.     (prompt "\nInvalid input specifications... Restart routine with correct specifications next time again...")
  55.   )
  56.   (princ)
  57. )
  58.  

Regards,
HTH, M.R.
« Last Edit: February 14, 2016, 12:17:05 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

velasquez

  • Newt
  • Posts: 195
Re: Default angle
« Reply #4 on: February 14, 2016, 09:14:16 AM »
As you already have correct assumption, that value is built-in into ROTATE command and can't be extracted lightly... Perhaps, try this lisp to try to overcome this issue :
Regards,
HTH, M.R.

Thank you ribarm,
Your code works well.
I seek a simple method
I already have a pre-selected block and the base point.
What I did was rotate the block to 0 degrees and then recall the command "_.rotate" and allow the user to press ENTER to 0 degrees, simulating rotating command option "_.insert"
Specify rotation angle <0 >:
« Last Edit: February 14, 2016, 09:19:45 AM by velasquez »