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

Re-set variables with SCRIPT on opening exisitng files.

5 REPLIES 5
Reply
Message 1 of 6
Caff
454 Views, 5 Replies

Re-set variables with SCRIPT on opening exisitng files.

I am very new to script writing, and have looked through these discussion groups to try and create a script to re-set certain variables on Start-up as well as opening existing files once CAD is running. I have managed to create the switch, see below and the script, see below, which works great when you start CAD, but I don't know how to make this work for existing files. All of the variables are correct when opening up the template file, so this is not very affective, what I do want is stop people continuing to draw with incorrect settings, half of them don't even realise that they are incorrect ? there are only so many times you can say ?please follow company procedure? ? to 80 users!!

"C:\Program Files\AutoCAD LT 2004\aclt.exe" /t "L:\cad\templates\new\pte template-2.dwt" /b "PTE-StartUp"

PSLTSCALE 0
MEASUREMENT 1
SORTENTS 0
CECOLOR BYLAYER
CELTSCALE 1
CELTYPE BYLAYER
CELWEIGHT -1
THICKNESS 0

Any help in this would be very much appreciated.

Catherine
5 REPLIES 5
Message 2 of 6
tstright
in reply to: Caff

Maybe if one of them were let go..The others might start to listen.
Sometimes things need to be taken to extemes for people to sit up and notice.
Message 3 of 6
eddyrichardson
in reply to: Caff

Use a lisp file and run it every time a drawing is opened....i.e.

 

(defun c:svars (/)
(command "setvar" "imageframe" "2")
(command "setvar" "taskbar" "1")
(command "setvar" "previeweffect" "0")
(command "setvar" "gripobjlimit" "10000")
(command "setvar" "vtenable" "0")
(command "setvar" "menubar" "1")
(command "setvar" "savetime" "12")
(command "setvar" "recoverymode" "2")
(command "setvar" "xloadctl" "0")
(command "setvar" "isavepercent" "0")
(command "setvar" "ribbonbgload" "0")
(command "setvar" "gripcontour" "7")
(command "setvar" "layerdlgmode" "0")
(command "setvar" "layerevalctl" "0")
(setenv "ShowTabs" "1")
(princ)
)

Message 4 of 6


@Anonymous wrote:

Use a lisp file and run it every time a drawing is opened....i.e.

 

(defun c:svars (/)
(command "setvar" "imageframe" "2")
....etc....

(command "setvar" "layerevalctl" "0")
(setenv "ShowTabs" "1")
(princ)
)


If you're going to do that, I would recommend using the (setvar) Lisp function itself, rather than (command "setvar" ....), for each of those.  The (command) function is comparatively "heavy lifting" and will take longer, in addition to involving a lot more code characters, partly for the command words themselves and partly for the double-quotes around all the values, which you don't need in (setvar).  Also, in (getvar)/(setvar) you can use an apostrophe only at the beginning of a System Variable name, rather than double-quotes at both ends [though that also works].

 

(defun c:svars (/)
  (setvar 'imageframe 2)
  (setvar 'taskbar 1)
  (setvar 'previeweffect 0)
  ....etc....

  (setvar 'layerevalctl 0)
  (setenv "ShowTabs" "1")
  (princ)
)

Kent Cooper, AIA
Message 5 of 6
scot-65
in reply to: Caff

Others here seemed to ignore the fact you are using LT.

One would have to manually start the script as no LISP facilities is available for LT.

 

Someone chime in if it is possible to embed the S::STARTUP or equivalent in a LT platform?

If so, (command ".SCRIPT" ...

 

???


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


Message 6 of 6
eddyrichardson
in reply to: Caff

Thanks for the Apostrophe tip - makes it a lot easier.....

 

Of course if using LT then a script is required.

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

Post to forums  

Autodesk Design & Make Report

”Boost