CUI -> How to assign Ctrl+R to POLAR?

CUI -> How to assign Ctrl+R to POLAR?

Anonymous
Not applicable
1,098 Views
13 Replies
Message 1 of 14

CUI -> How to assign Ctrl+R to POLAR?

Anonymous
Not applicable

Hello,

I am really angry becasue we often switch between ORTHO on/off, POLAR on/off. The keys of these commands - [F8] and [F10] are relative far to press. They are not under hand like for example [A], If we want to switch OSNAP on/off, we have to press [F3], which is not so far as [F8].

If we want to switch Object Snap Tracking on/off, we have to press [F11], which is far, but it is better to have this option always on.

 

So I typed CUI, Enter, and in the bookmark "Customize" I went to Keyboard Shortcuts -> Shortcut Keys.

I set ORTHO to [Ctrl]+[E], and OSNAP to [Ctrl]+[F].

I want to set POLAR to [Ctrl]+[R] and Object Snap Tracking to [Ctrl]+[D], but there are not such existing macros (whichever name it has) of "Toggle Polar" and "Toggle Object Snap" to assign to these keys combinations.

 

Is there a way which I could assign POLAR to [Ctrl]+[R] and Object Snap Tracking to [Ctrl]+[D]?

Please, help.

0 Likes
1,099 Views
13 Replies
Replies (13)
Message 2 of 14

Anonymous
Not applicable

Anybody knows it? Is there a macro to POLAR?

Please, if there is no solution to assign Ctrl+R as POLAR, write it.

I will be not incertain.

0 Likes
Message 3 of 14

Lee_Mac
Advisor
Advisor

In the CUI dialog, under ACAD ≫ Keyboard Shortcuts ≫ Shortcut Keys change the macro for CTRL+R to the following:

 

^P(setvar 'autosnap (boole 6 8 (getvar 'autosnap)))(princ)

 

Message 4 of 14

Anonymous
Not applicable

Yes, it works! Thank you!

Now I have Ctrl+E as ORTHO ([F8]), Ctrl+R as POLAR ([F10]), Ctrl+F as OSNAP ([F3]).

Only Object Snap Tracking ([F11]) is left. I want to assign Ctrl+D to it.

 

I don't know if I should make new topic to ask this question, but by the way...

What should I type in macro to assign Ctrl+D to Object Snap tracking.

 

I typed in Google "autocad macro object snap tracking", but no result is good.

 

And there are two more questions:

2. How to write lisp for POLAR? I wrote these lisps:

(defun c:RQ1 (setvar "DYNMODE" 15))
(defun c:RQQ1 (setvar "DYNMODE" 0))

(defun c:RQ (command "_DYNMODE" "15"))
(defun c:RQQ (command "_DYNMODE" "0"))

(defun c:RQ2 (command "DYNMODE" "15"))
(defun c:RQQ2 (command "DYNMODE" "0"))

 But there is syntax error and I don't know where.

 

3. How to write lisp for Object Sbap Tracking?

I tried to find the System Variable, on the forums users mentioned "OTRACK", but in my AutoCad 2012 there is not such command.

 

I think these lisps number 2. and 3. will be without sence, because I made lisps for ORTHO

; QR1 - włącza ORTHO 
(defun C:QR1  () (setvar "ORTHOMODE" 1))

; - - - - - - - - - - - - - - - - - - - - - - - - - 

; QR11 - wyłącza ORTHO
(defun C:QRR1 () (setvar "ORTHOMODE" 0))

; ----------------------------------------------------

; Nie można go użyć pomiędzy kliknięciem w jeden punkt rysowanej Poliliniii a kliknięciem w drugi punkt rysowanej ;Polilinii.
; Za to F8 = Ortho już można. 
; You can't use it between one and next click while Polyline (or Line, Spline, etc.) drawing. ; But you can use [F8].
; QR - włącza ORTHO (defun C:QR () (command "ORTHO" "ON" )) ; - - - - - - - - - - - - - - - - - - - - - - - - - ; QRR - wyłącza ORTHO (defun C:QRR () (command "ORTHO" "OFF"))

 and you can't use it between one and next click while Polyline (or Line, Spline, etc.) drawing.
 But you can press [F8].

 

0 Likes
Message 5 of 14

Lee_Mac
Advisor
Advisor
damian.wrobel wrote:

Yes, it works! Thank you!

 

You're welcome!

 

damian.wrobel wrote:

Now I have Ctrl+E as ORTHO ([F8]), Ctrl+R as POLAR ([F10]), Ctrl+F as OSNAP ([F3]).

Only Object Snap Tracking ([F11]) is left. I want to assign Ctrl+D to it.

 

I don't know if I should make new topic to ask this question, but by the way...

What should I type in macro to assign Ctrl+D to Object Snap tracking.

 

Try the following macro:

 

^P(setvar 'autosnap (boole 6 16 (getvar 'autosnap)))(princ)

 

damian.wrobel wrote:

2. How to write lisp for POLAR? I wrote these lisps:

(defun c:RQ1 (setvar "DYNMODE" 15))
(defun c:RQQ1 (setvar "DYNMODE" 0))

(defun c:RQ (command "_DYNMODE" "15"))
(defun c:RQQ (command "_DYNMODE" "0"))

(defun c:RQ2 (command "DYNMODE" "15"))
(defun c:RQQ2 (command "DYNMODE" "0"))

 But there is syntax error and I don't know where.

 

You are missing the list of arguments/variables for each defun statement:

 

(defun c:RQ1 ( / ) (setvar "DYNMODE" 15))

 

damian.wrobel wrote:

3. How to write lisp for Object Sbap Tracking?

I tried to find the System Variable, on the forums users mentioned "OTRACK", but in my AutoCad 2012 there is not such command.

 

Object Snap Tracking is bit-code 4 (16) of the AUTOSNAP system variable, hence, if you want a program to toggle this setting on & off, you could use something like (using an XOR mask):

 

(defun c:ot nil (setvar 'autosnap (boole 6 16 (getvar 'autosnap))) (princ))

 

damian.wrobel wrote:

 and you can't use it between one and next click while Polyline (or Line, Spline, etc.) drawing.
 But you can press [F8].

 

 

You would need to call the custom commands transparently in order to evaluate them whilst an AutoCAD command is running, e.g.:

 

Command: l LINE
Specify first point:
Specify next point or [Undo]: 'ot

Specify next point or [Undo]:

 

0 Likes
Message 6 of 14

Anonymous
Not applicable
Life could be any better. Thos macro works and now I have all four shortcuts! Thank you.
0 Likes
Message 7 of 14

Anonymous
Not applicable

I repaired my lisps and now they are so:

(defun c:RQ1 (/) (setvar "DYNMODE" 15))
(defun c:RQQ1 (/) (setvar "DYNMODE" 0))

(defun c:RQ (/) (command "_DYNMODE" "15"))
(defun c:RQQ (/) (command "_DYNMODE" "0"))

(defun c:RQ2 (/) (command "DYNMODE" "15"))
(defun c:RQQ2 (/) (command "DYNMODE" "0"))



Command: Command: RQ Requires an integer between -3 and 3. ; error: Function cancelled Enter new value for DYNMODE <0>: rqq Requires an integer between -3 and 3. Enter new value for DYNMODE <0>: rq Requires an integer between -3 and 3. Enter new value for DYNMODE <0>: rqq Requires an integer between -3 and 3. Enter new value for DYNMODE <0>: dynmode Requires an integer between -3 and 3. Enter new value for DYNMODE <0>: 15 Requires an integer between -3 and 3. Enter new value for DYNMODE <0>: dynmode Requires an integer between -3 and 3.

 But there are strange errors.

 

For example, this:

; http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-D91628CC-9975-4DBF-8D02-10B23A6F3ED5
; POLARMODE (System Variable)
;Controls settings for polar and object snap tracking.
;Type: Bitcode
;Saved in: Registry
;Initial value: 0
;The setting is stored as a bitcode using
; the sum of the following values:
;;;
;Polar angle measurements
;0 Measure polar angles based on current UCS (absolute)
;1 Measure polar angles from selected objects (relative)
;;;
;Object snap tracking
;0 Track orthogonally only
;2 Use polar tracking settings in object snap tracking
;;;
;Use additional polar tracking angles
;0 No
;4 Yes
;;;
;Acquire object snap tracking points
;0 Acquire automatically
;8 Press SHIFT to acquire
;;;
;Note: In an AutoCAD 3D environment, a tracking vector
; parallel to the Z axis of the UCS is also displayed,
; and the tooltip displays +Z and -Z for the angle
; depending on the direction along the Z axis.

 

I count the sum of 1+2+4+8=15 and 15 is in my lisp. But AutoCad wants value batween 3 and -3...

None of these lisp works.

 

0 Likes
Message 8 of 14

Anonymous
Not applicable

I don't think I can use these lisps between two next clicks in the Line's vertices.

 

My lisps for ortho:

; QR1 - włącza ORTHO 
(defun C:QR1  (/) (setvar "ORTHOMODE" 1))

; - - - - - - - - - - - - - - - - - - - - - - - - - 

; QR11 - wyłącza ORTHO
(defun C:QRR1 (/) (setvar "ORTHOMODE" 0))

; ----------------------------------------------------

; Nie można go użyć pomiędzy kliknięciem w jeden punkt rysowanej Poliliniii a kliknięciem w drugi punkt rysowanej Polilinii.
; Za to F8 = Ortho już można. 
; You can't use it between one and next click while Polyline (or Line, Spline, etc.) drawing.
; But you can press [F8].

; QR - włącza ORTHO 
(defun C:QR   (/) (command "ORTHO" "ON" ))

; - - - - - - - - - - - - - - - - - - - - - - - - -

; QRR - wyłącza ORTHO 
(defun C:QRR  (/) (command "ORTHO" "OFF"))

 

And here are my results, documented in CommandLine:

Command:
Command: LINE Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]: 'qr
Point or option keyword required.
; error: Function cancelled

Specify next point or [Undo]: 'qr
Point or option keyword required.
; error: Function cancelled

Specify next point or [Undo]: 'qrr
Point or option keyword required.
; error: Function cancelled

Specify next point or [Undo]:
Specify next point or [Close/Undo]: *Cancel*

Command: *Cancel*

 

 

0 Likes
Message 9 of 14

Lee_Mac
Advisor
Advisor
damian.wrobel wrote:
Life could be any better. Thos macro works and now I have all four shortcuts! Thank you.

 

You're most welcome - happy to help!

 

Lee

0 Likes
Message 10 of 14

Anonymous
Not applicable

Wow, this trick with "'ot" I can see first time in my life. I didn't hear about it.

On none of cad sites I read. Nobody told me about it. Just you now.

 

I tried and it works.

 

So I on the same rule did lisp for POLAR:

; Macro for POLAR is:
; ^P(setvar 'autosnap (boole 6 8 (getvar 'autosnap)))(princ)

;QAR = 'pOlAR
(defun c:QAR nil
 (setvar 'autosnap
  (boole 6 8 (getvar 'autosnap))
 )
 (princ)
)

;1st case:
;Command: LIne Specify first point:
;Specify next point or [Undo]:
;Specify next point or [Undo]:
;Specify next point or [Close/Undo]: qar ; <<< doesn't work
;Point or option keyword required.
;Specify next point or [Close/Undo]:
;Command:  LINE Specify first point:
;Specify next point or [Undo]:
;Command:  LINE Specify first point:

;2nd case:
;Command: LIne Specify first point:
;Specify next point or [Undo]: 'qar ; <<<<< It works!
;Specify next point or [Undo]:

 

And it works.

 

I did the same for ORTHOMODE, not part of ORTHO's macro copied to the lisp.

And in this way it doesn't work:

; QR1 - włącza ORTHO 
(defun C:QRT1  (/) (setvar "ORTHOMODE" 1))

; - - - - - - - - - - - - - - - - - - - - - - - - - 

; QR11 - wyłącza ORTHO
(defun C:QRRT1 (/) (setvar "ORTHOMODE" 0))

; ----------------------------------------------------

; Nie można go użyć pomiędzy kliknięciem w jeden punkt rysowanej Poliliniii a kliknięciem w drugi punkt rysowanej Polilinii.
; Za to F8 = Ortho już można. 
; You can't use it between one and next click while Polyline (or Line, Spline, etc.) drawing.
; But you can press [F8].

; QR - włącza ORTHO 
(defun C:QRT   (/) (command "ORTHO" "ON" ))

; - - - - - - - - - - - - - - - - - - - - - - - - -

; QRR - wyłącza ORTHO 
(defun C:QRRT  (/) (command "ORTHO" "OFF"))

 but it doesn't work

Command: AD DW ORTHOMODE.lsp successfully loaded.

nil

Command:
Command:
Command: QRRT nil

Command:  QRRT nil

Command:  QRRT nil

Command: QRRT nil

Command: *Cancel*

Command: QRT nil

Command: Q nil
Specify first point:
Specify next point or [Undo]: 'QRRT
Point or option keyword required.
; error: Function cancelled

Specify next point or [Undo]: Q
Point or option keyword required.

Specify next point or [Undo]: 'QRRT1 0
Zero length line created at (77313.2515, -23301.8141, 0.0000)

Specify next point or [Undo]: 'QR
Specify next point or [Undo]:
Specify next point or [Undo]: 'QRT
Point or option keyword required.
; error: Function cancelled

Specify next point or [Undo]: 'QRRT
Point or option keyword required.
; error: Function cancelled

Specify next point or [Undo]: *Cancel*

 I wonder if I copy part of ORTHO's macro it will be good.

But after I typed CUI, Enter, I saw that ORTHO's macro is simply ^O.

 

Is there some other macro for ORTHO? 

 

 

 

 

 

0 Likes
Message 11 of 14

Lee_Mac
Advisor
Advisor

Try:

 

(defun c:or nil (setvar 'orthomode (- 1 (getvar 'orthomode))) (princ))

 

0 Likes
Message 12 of 14

Anonymous
Not applicable

Thank you, it works.

0 Likes
Message 13 of 14

Lee_Mac
Advisor
Advisor
damian.wrobel wrote:

Thank you, it works.

 

Excellent, you're welcome.

0 Likes
Message 14 of 14

Anonymous
Not applicable

I didn't write what is the macro for OSNAP and ORTHO.

Now in the CUI I have "'_OSMODE 1152 " for OSNAP and "^O ".

But they seem strange to me.

Do they are both properly?

If not, please write the properly ones.

0 Likes