SETVAR in startup doc not working

SETVAR in startup doc not working

JohnC_ISM
Collaborator Collaborator
1,649 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,650 Views
27 Replies
Replies (27)
Message 2 of 28

Kent1Cooper
Consultant
Consultant

You're using On/Off for some System Variables whose values are 0/1.

 

[And if they were On/Off, they would need double-quote wrappings.]

Kent Cooper, AIA
0 Likes
Message 3 of 28

JohnC_ISM
Collaborator
Collaborator
okay i mixed that one. also whats the text input to turn off taskbar? it says taskbar isnt a variable.

would i use setenv?
or is there a template you have to make it autotype the command and setting?
0 Likes
Message 4 of 28

dmfrazier
Advisor
Advisor

Help can be helpful:dmfrazier_0-1679941119943.png

In LISP, use the command function.

(command "taskbar" 0) or (command "taskbar" 1)

0 Likes
Message 5 of 28

Kent1Cooper
Consultant
Consultant
Accepted solution

@JohnC_ISM wrote:
.... whats the text input to turn off taskbar? ....

Help will lead you to find that TASKBAR is a command, not a System Variable.  So:

 

(command "_.taskbar" 0)

Kent Cooper, AIA
0 Likes
Message 6 of 28

JohnC_ISM
Collaborator
Collaborator
omg i read that a thousand times and i thought i know its a command how do i get it to use it.
i get it now okay cool. ill look around and try to find a list of each type of variable so im more prepared for future issues.
0 Likes
Message 7 of 28

dmfrazier
Advisor
Advisor

The Express Tool, System Variable Editor (_.sysvdlg) can be very helpful, as well.

0 Likes
Message 8 of 28

JohnC_ISM
Collaborator
Collaborator

okay so in general though can i add item lines (see below) like this to the acaddoc to execute automatically when i open any drawing?

 

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

(princ "Task Set.")

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

(princ "Snap Set.")

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

(princ "Ortho Set.")

;::: set plinegen
(command "plinegen" ON)

(princ "PLgen Set.")

;;;;set mirrortext
(command "mirrtext" OFF)

(princ "MirrText Set.")

;;;;;set osnap mode
(setvar "osmode" 47)

(princ "OSmode Set.")

;;;set windows open limit
(command "SDI" 1)

(princ "OpenWindows Set.")

;;;set Donut ID
(command "donutid" 0)

(princ "Donut ID = 0.00.")

 

 

0 Likes
Message 9 of 28

dmfrazier
Advisor
Advisor

Note that some "setvars" are (a) saved in the DWG file, while others are (b) application specific (saved in the registry for the AutoCAD app/user).

I try to set (a) in acaddoc.lsp and (b) in acad.lsp.

0 Likes
Message 10 of 28

JohnC_ISM
Collaborator
Collaborator
I guess that makes sense, I thought "command" meant it was telling autocad to auto-type that.

Is there a certain combination of text that would do that? it would set something by typing it in itself? Im just making this string up but -----> (auto "fillet" "radius" 0)

* Start the command (auto "fillet" "radius" 0)
* Select the setting (auto "fillet" "radius" 0)
* Set to user entry (auto "fillet" "radius" 0)
That way I could go around the office and just copy and paste the list of variables into everybody's lisp doc?
0 Likes
Message 11 of 28

dmfrazier
Advisor
Advisor

"Command" is an AutoLISP function that is used to run a command as if it were being run on the commandline.

You certainly can take any of these lines and copy them to other AutoCAD users' startup LSPs. (Another option is to locate a standard, shared set of startup LSPs on a network share folder and point each user to the same file.)

 

Some of these settings are stored in the user Profile (they are stored as Windows Registry settings). Profiles can be exported from one user and imported by another. (Note that some profile settings contain files and/or paths that may or may not exist on both users' machines.)

0 Likes
Message 12 of 28

JohnC_ISM
Collaborator
Collaborator
Yeah the first option is what my end goal was. And to make sure im putting these lines in the right place is there anywhere particular they should be? Right now I have them at the end of my 'acad2022doc.lsp' file before the big encryption key.

Also, if theres a command like in my example where theres two steps to get to user desired input like 'fillet, radius' 0...how would that be written in the line of text?

* (command "fillet" "radius" 0)
* OR
* (command "fillet" radius, 0)
0 Likes
Message 13 of 28

dmfrazier
Advisor
Advisor

Don't modify the "acad2022doc.lsp" file.

Make your own acaddoc.lsp and place it in a folder that is listed in AutoCAD's search paths (Options, Files, Support Files Search Path).

The order you put them in that file is not particularly important. (I tend to list them alphabetically.)

If you want to see if a particular syntax works, run it on the command line. (In general, commands and their options would be enclosed in quotes.)

0 Likes
Message 14 of 28

JohnC_ISM
Collaborator
Collaborator
Okay looks like theres already one of those files so ill just add it into it.
And okay cool thank you ill give all these a try.
0 Likes
Message 15 of 28

Kent1Cooper
Consultant
Consultant

@JohnC_ISM wrote:
.... where theres two steps to get to user desired input like 'fillet, radius' 0...how would that be written in the line of text?

* (command "fillet" "radius" 0)
* OR
* (command "fillet" radius, 0)

The first one.  But really:

(setvar 'filletrad 0)

With a lot of things to set, using (setvar) instead of (command) could make a noticeable difference in the time it takes -- getting in and out of the (command) processor takes more time than doing it with (setvar).

 

And in your longer list in Message 8, be careful about valid values.  For example:

 

(command "snapmode" off)

 

Aside from the fact that the "off" should be wrapped in double-quotes, that won't work anyway, because the value of the SNAPMODE System Variable is not On or Off, but numerical.  You can do:

 

(command "_.snap" "_off")

 

if you want, but when using System Variable names, you need to look into their valid values.  And when using (command), you need to know what the command in question is going to want as input.  And if that's a text-string input, it needs to be in double-quotes.

Kent Cooper, AIA
Message 16 of 28

JohnC_ISM
Collaborator
Collaborator
Okay thank you. This is all good stuff I need. Thank you !
0 Likes
Message 17 of 28

Sea-Haven
Mentor
Mentor

I have always used the Appload "startup suite" and loaded custom lisps just find it easier that trying to put a acad.lsp etc in right directory.

 

Suggestion 2 is do a foreach and just make a list of variable names and their setting, (("osmode" 47)("Taskbar" 0)......

 

If you save a profile with all your settings then its easy to start CAD with that profile, just copy the desktop icon, right click got to "Properties"

 

Ok in the Target you will see the /P this is profile switch so swap out default for your profile name. In this example "<CIV3D_Metric>>"

 

SeaHaven_0-1680933335876.png

You can edit General as well say make it Stephen CAD.

 

 

 

 

 

0 Likes
Message 18 of 28

JohnC_ISM
Collaborator
Collaborator

okay i dont understand everything i do doesnt work. 

 

;;;;;; set snap
(command "snap" "off")

(princ "Snap Set.")

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

(princ "Ortho Set.")

;::: set plinegen
(command "plinegen" ON)

(princ "PLgen Set.")

;;;;set mirrortext
(command "mirrtext" "OFF")

(princ "MirrText Set.")

;;;;;set osnap mode
(setvar "osmode" 47)

(princ "OSmode Set.")

;;;set windows open limit
(command "SDI" "1")

(princ "OpenWindows Set.")

;;;set Donut ID
(command "donutid" "0")

(princ "Donut ID = 0.00.")

;;;set Open Mode
(SETVAR "STARTUP" 2)  

(princ "Startup Loaded")

 

 

everybody says a diff **** thing. and ive tried them all. none work. 

0 Likes
Message 19 of 28

Sea-Haven
Mentor
Mentor

Worked for me as posted, I added set fillet radius to zero and run fillet.

 

(defun c:f0 ()(setvar 'filletrad 0.0)(command "fillet"))

 

 

I try to use setvar whenever possible.

 

(setvar 'donutid 0.0) 
(setvar 'mirrtext 0)
(setvar 'plinegen 0)
(setvar 'sdi 1)

 

Save it all as a custom lisp, then use Appload and add to "Start Up Suite", it will load then on start up.

 

0 Likes
Message 20 of 28

JohnC_ISM
Collaborator
Collaborator
I dont think mines reading it at all. Ive got it in the acaddoc2022 and its not seeing it. Because at one point i had some of what you’re saying.
But i didnt realize what you meant by start up suite until after i left work. Ill try that.



0 Likes