Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Polar Tracking

4 REPLIES 4
Reply
Message 1 of 5
brian.wiley
1069 Views, 4 Replies

Polar Tracking

Is there a way to turn on/off polar tracking from the command line or with a system variable? I'm trying to write a lisp that will temporarily disable polar tracking, execute the meat of the routine, then turn polar tracking back on.

Thanks!
4 REPLIES 4
Message 2 of 5
_gile
in reply to: brian.wiley

Hi,

Its 16 bit code in AUTOSNAP sysvar.

Turn off polar tracking (even it' already off)
(setvar "AUTOSNAP" (Boole 4 16 (getvar "AUTOSNAP")))

Turn on (even it's already on)
(setvar "AUTOSNAP" (Boole 7 16 (getvar "AUTOSNAP")))


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 5
brian.wiley
in reply to: brian.wiley

I couldn't get the "Turn On" to work, but it did help me figure out the autosnap sysvar. Here are the resulting lisps:

(defun C:sa ()
(princ "Set Snap Angle\n")
(Command "AUTOSNAP" "55" "snapang" pause pause "ortho" "on")
(princ)
);end


(defun C:sar ()
(princ "Reset Snap Angle\n")
(command "ortho" "off" "autosnap" "63")
(setvar "snapang" 0)
(princ)
);end

Thanks!
Message 4 of 5
thatcadguy
in reply to: brian.wiley

Using command is fine, but it's better use setvar's when you can. Why does one use command for SNAPANG and the other use setvar for it?

Regards, Jake
___________________________
http://thatcadguy.blogspot.com/
Message 5 of 5
Kent1Cooper
in reply to: brian.wiley

To answer thatcadguy's question, even though not directly in reply to his post:

I will often set a System Variable using it as though a command, in a (command) function, when I've got one of those running anyway, simply because it saves some code as compared to using (setvar), especially when doing several of them, since (setvar) can only do one at a time, requiring a separate (setvar) function for each variable. Sometimes I wish you could combine multiple variables into one (setvar) function, the way you can with (setq).

BUT another question arises [the reasons I'm answering that in reply to this post instead]:

This code would have a problem if a User *typed in* an angle for the SNAPANG System Variable, rather than picking two points, since only one pause would be used up by that. If you know you'll always want to do it with point picks, then that's fine, but you could give the User the choice of how to do it, if you want:

(setvar 'autosnap 55)
(setvar 'snapang (getangle "\nSnap angle: "))
(setvar 'orthomode 1)

[I tried putting those into one (command) function, but it didn't handle the optional number of inputs to (getangle) in there as I hoped it would.]

--
Kent Cooper


brian.wiley wrote...
....
(Command "AUTOSNAP" "55" "snapang" pause pause "ortho" "on")
....
Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost