Author Topic: Rotate angle prompt display  (Read 1418 times)

0 Members and 1 Guest are viewing this topic.

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Rotate angle prompt display
« 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 :

Code: [Select]
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>:
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

BIGAL

  • Swamp Rat
  • Posts: 1417
  • 40 + years of using Autocad
Re: Rotate angle prompt display
« Reply #1 on: April 10, 2018, 05:03:58 AM »
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.
A man who never made a mistake never made anything

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: Rotate angle prompt display
« Reply #2 on: April 10, 2018, 05:09:14 AM »
AUPREC sys var is controlling precision I am looking for - just it can be above 8 digits...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

VovKa

  • Water Moccasin
  • Posts: 1631
  • Ukraine
Re: Rotate angle prompt display
« Reply #3 on: April 10, 2018, 06:44:34 AM »
So the question - how can I retrieve that angle
(getvar "LASTANGLE")

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: Rotate angle prompt display
« Reply #4 on: April 10, 2018, 06:47:49 AM »
What I did was something like this :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:ro ( / ss bp ch pp p1 p2 ) ; *a* is global variable
  2.   (setq ss (ssget "_:L"))
  3.   (if ss
  4.     (progn
  5.       (initget 1)
  6.       (setq bp (getpoint "\nPick or specify base point : "))
  7.       (initget "Copy Reference Both")
  8.       (setq ch (getkword (strcat "\nSpecify rotation angle or [Copy/Reference/Both] - ENTER (no option keyword) " (if (null *a*) ": " (strcat "<" *a* "> : ")))))
  9.       (cond
  10.         ( (and (null ch) (null *a*))
  11.           (vl-cmdf "_.ROTATE" ss "" "_non" bp)
  12.           (while (< 0 (getvar 'cmdactive)) (vl-cmdf "\\"))
  13.           (setq pp (cadr (grread t)))
  14.           (princ (setq *a* (rtos (cvunit (angle bp pp) "radian" "degree") 2 50)))
  15.         )
  16.         ( (and (null ch) *a*)
  17.           (initget "Yes No")
  18.           (setq ch (getkword "\nRotate with default angle [Yes/No] <Yes> : "))
  19.           (if (null ch)
  20.             (setq ch "Yes")
  21.           )
  22.           (if (= ch "Yes")
  23.             (vl-cmdf "_.ROTATE" ss "" "_non" bp *a*)
  24.             (progn
  25.               (vl-cmdf "_.ROTATE" ss "" "_non" bp)
  26.               (while (< 0 (getvar 'cmdactive)) (vl-cmdf "\\"))
  27.               (setq pp (cadr (grread t)))
  28.               (princ (setq *a* (rtos (cvunit (angle bp pp) "radian" "degree") 2 50)))
  29.             )
  30.           )
  31.         )
  32.         ( (and (= ch "Copy") (null *a*))
  33.           (vl-cmdf "_.ROTATE" ss "" "_non" bp "_C")
  34.           (while (< 0 (getvar 'cmdactive)) (vl-cmdf "\\"))
  35.           (setq pp (cadr (grread t)))
  36.           (princ (setq *a* (rtos (cvunit (angle bp pp) "radian" "degree") 2 50)))
  37.         )
  38.         ( (and (= ch "Copy") *a*)
  39.           (initget "Yes No")
  40.           (setq ch (getkword "\nRotate copy with default angle [Yes/No] <Yes> : "))
  41.           (if (null ch)
  42.             (setq ch "Yes")
  43.           )
  44.           (if (= ch "Yes")
  45.             (vl-cmdf "_.ROTATE" ss "" "_non" bp "_C" *a*)
  46.             (progn
  47.               (vl-cmdf "_.ROTATE" ss "" "_non" bp "_C")
  48.               (while (< 0 (getvar 'cmdactive)) (vl-cmdf "\\"))
  49.               (setq pp (cadr (grread t)))
  50.               (princ (setq *a* (rtos (cvunit (angle bp pp) "radian" "degree") 2 50)))
  51.             )
  52.           )
  53.         )
  54.         ( (= ch "Reference")
  55.           (initget 1)
  56.           (setq p1 (getpoint bp "\nPick or specify start reference point : "))
  57.           (vl-cmdf "_.ROTATE" ss "" "_non" bp "_R" "_non" bp "_non" p1)
  58.           (while (< 0 (getvar 'cmdactive)) (vl-cmdf "\\"))
  59.           (setq p2 (cadr (grread t)))
  60.           (princ (setq *a* (rtos (cvunit (rem (+ pi pi (- (angle bp p2) (angle bp p1))) (+ pi pi)) "radian" "degree") 2 50)))
  61.         )
  62.         ( (= ch "Both")
  63.           (initget 1)
  64.           (setq p1 (getpoint bp "\nPick or specify start reference point : "))
  65.           (vl-cmdf "_.ROTATE" ss "" "_non" bp "_C" "_R" "_non" bp "_non" p1)
  66.           (while (< 0 (getvar 'cmdactive)) (vl-cmdf "\\"))
  67.           (setq p2 (cadr (grread t)))
  68.           (princ (setq *a* (rtos (cvunit (rem (+ pi pi (- (angle bp p2) (angle bp p1))) (+ pi pi)) "radian" "degree") 2 50)))
  69.         )
  70.       )
  71.       (initget "Yes No")
  72.       (if (= "Yes" (getkword "\nDo you want to nil *a* variable - i.e. start rotate command next time without default angle [Yes/No] <No> : "))
  73.         (setq *a* nil)
  74.       )
  75.     )
  76.   )
  77.   (princ)
  78. )
  79.  

Code - Auto/Visual Lisp: [Select]
  1. (defun c:roo ( / ss bp ) ; rotate opposite ; *a* is global variable
  2.   (setq ss (ssget "_:L"))
  3.   (if (and ss *a*)
  4.     (progn
  5.       (initget 1)
  6.       (setq bp (getpoint "\nPick or specify base point : "))
  7.       (vl-cmdf "_.ROTATE" ss "" "_non" bp (strcat "-" *a*))
  8.     )
  9.   )
  10.   (princ)
  11. )
  12.  

But not sure, haven't checked for (getvar 'lastangle) as VovKa suggested...
« Last Edit: April 10, 2018, 09:51:16 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

NICK_VNV

  • Newt
  • Posts: 63
Re: Rotate angle prompt display
« Reply #5 on: April 10, 2018, 09:20:15 AM »
Quote
(getvar "LASTANGLE")
I think this variable is for some other purposes.
Sorry for my English...