SETVAR in startup doc not working

SETVAR in startup doc not working

JohnC_ISM
Collaborator Collaborator
1,678 Views
27 Replies
Message 1 of 28

SETVAR in startup doc not working

JohnC_ISM
Collaborator
Collaborator

im trying to just get things to change to how i like when i open drawings. for instance my dad uses ortho mode and i hate it so i made a list of things i wanted to get set up but they just wont work. i test them by typing SETVAR in the command and then finding the official alias for it but it stays the same. 

 

 

 

;;;;;; set task
(setvar "taskbar" 0)

(princ "Task Set.")

;;;;;; set snap
(setvar "snapmode" off)

(princ "Snap Set.")

;;;; set ortho 
(setvar "orthomode" 0)

(princ "Ortho Set.")

;;;; set pline
(setvar "plinewid" 0)

(princ "PLwidth Set.")

:::: set plinegen
(setvar "plinegen" ON)

(princ "PLgen Set.")

 

 

0 Likes
Accepted solutions (1)
1,679 Views
27 Replies
Replies (27)
Message 21 of 28

Sea-Haven
Mentor
Mentor

We load around 5 lisps that have about 30 defuns inside plus 20 Autoloads. All set up in Start up Suite.

0 Likes
Message 22 of 28

JohnC_ISM
Collaborator
Collaborator
Yeah i have a ton of lisps in there but never thought of puttin one with settings in there.
0 Likes
Message 23 of 28

JohnC_ISM
Collaborator
Collaborator

im sorry but all of this is so confusing because terms are contradicting in my head as to what to do. 

 

so i can put this into my start up suite??

 

(defun:23start)

(command "snap" "off")
(princ "Snap Set.")

(setvar "orthomode" 0)
(princ "Ortho Set.")

(command "plinegen" ON)
(princ "PLgen Set.")

(command "mirrtext" "OFF")
(princ "MirrText Set.")

(setvar "osmode" 47)
(princ "OSmode Set.")

(command "SDI" "1")
(princ "OpenWindows Set.")

(command "donutid" "0")
(princ "Donut ID = 0.00.")

(SETVAR "STARTUP" 2)  
(princ "Startup Loaded")

 

im about to make an action macro of me setting all these and then just making a lisp that calls the macro and toss that into the suite. so far each person tells me "thats a command" or "no thats a setvar". and ive checked both. some are literally both and have both options.  

 

an action macro would solve all of this and let me just use the command line and autocad can do the rest im just not sure what the starting thing is for a lisp to just run in the suite

 

if i removed the defun then will it auto run? 

0 Likes
Message 24 of 28

Sea-Haven
Mentor
Mentor

If its part of the start up suite then no need for a defun but if still want a defun, it should be (defun c:23start so can type on command line when required. The C: implies its is now a command.

 

0 Likes
Message 25 of 28

JohnC_ISM
Collaborator
Collaborator
Ahhhhhh. I have wondered what that means and last time I looked it up someone had said it was the initial of the original lisp creator. So somewhere in my lisps theres one with SM: in it. lol
0 Likes
Message 26 of 28

Sea-Haven
Mentor
Mentor

Yes AH:Getvals, LM:setdynpropvalue but you have to call the defun from your code (AH:Getvals variableshere) if you wanted to run from command line need to type it as a lisp function not a command, 

 

Type on command line (c:runmylisp) or runmylisp.

 

 

0 Likes
Message 27 of 28

Kent1Cooper
Consultant
Consultant

@JohnC_ISM wrote:
....
(command "plinegen" ON)
....
(command "mirrtext" "OFF")
....

.... 


Re-read my earlier Reply.  Those two, at least, are not valid values -- they need to be numbers [read about those System Variables in Help, and try it manually at the Command line].

 

[And even if they were on/off values, the ON would need to be in quotation marks, as the OFF is.]

Kent Cooper, AIA
0 Likes
Message 28 of 28

Kent1Cooper
Consultant
Consultant

@JohnC_ISM wrote:

..... so far each person tells me "thats a command" or "no thats a setvar". and ive checked both. some are literally both and have both options.  ....


Just to clarify a little....  There was a time [pretty long ago now] when System Variables were "only" System Variables, and not also usable as Command names.  Some time back they changed it so that you can put in a System Variable name as if it were a Command name, so they now function "like" Commands.  [But it's faster to set them with (setvar) than with (command).]

 

The easy way to tell whether something is a System Variable that you can use as if it's a Command name if you want to, is to get into Help and type the name into the Search window, and it will show you what it is, without even the need to actually go into the Help entry about it:

 

Kent1Cooper_1-1682348237357.png

 

Admittedly, at least one of them is schizophrenic -- DIMSTYLE exists as both separately, and the System Variable version is [for some unknown reason] read-only, so you can't use (setvar) to change it, but must do it with the Command version.  There may be others in the same boat -- that's just one I know about.

 

 

Kent Cooper, AIA
0 Likes