Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Active Contributor
Caff
Posts: 42
Registered: ‎12-03-2003
Message 1 of 6 (184 Views)

Re-set variables with SCRIPT on opening exisitng files.

184 Views, 5 Replies
05-09-2005 02:25 AM
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
Distinguished Contributor
tstright
Posts: 690
Registered: ‎06-21-2004
Message 2 of 6 (184 Views)

Re: Re-set variables with SCRIPT on opening exisitng files.

05-09-2005 05:36 AM 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.
Active Contributor
eddyrichardson
Posts: 36
Registered: ‎10-21-2008
Message 3 of 6 (147 Views)

Re: Re-set variables with SCRIPT on opening exisitng files.

03-30-2011 01:36 PM 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)
)

*Expert Elite*
Kent1Cooper
Posts: 5,791
Registered: ‎09-13-2004
Message 4 of 6 (145 Views)

Re: Re-set variables with SCRIPT on opening exisitng files.

03-30-2011 01:57 PM in reply to: eddyrichardson

eddyrichardson 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
*Expert Elite*
scot-65
Posts: 2,204
Registered: ‎12-11-2003
Message 5 of 6 (140 Views)

Re: Re-set variables with SCRIPT on opening existing files.

03-30-2011 03:48 PM 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::smileyfrustrated:TARTUP or equivalent in a LT platform?

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

 

???

Scot-65
Dyslexia is a permanent physical disability that cannot be seen.
Introverts is proof that there is indeed intelligent life on this planet.
Active Contributor
eddyrichardson
Posts: 36
Registered: ‎10-21-2008
Message 6 of 6 (123 Views)

Re: Re-set variables with SCRIPT on opening exisitng files.

04-04-2011 01:06 AM in reply to: Caff

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

 

Of course if using LT then a script is required.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!