Results 1 to 10 of 10

Thread: Run a script that sets Variables from a button or drawing startup.

  1. #1
    All AUGI, all the time SRBalliet's Avatar
    Join Date
    2004-06
    Location
    Near Christiansburg, VA Looking for a closer job!
    Posts
    500
    Login to Give a bone
    0

    Default Run a script that sets Variables from a button or drawing startup.

    I am trying to create a toolbar button. I always want my sysvars to be the same all the time whether saved in the drawing, registry or not saved. This is what I have so far but its not working:

    ^C^C filedia;0;script;L:\Data\Script\AutoCAD Variables.scr

    (In the script the file dia is turned back to "1")

    Any better ideas?

    How about a script that will run each time I open a drawing? It only takes a second to run the script and this would cover the sysvars that don't get saved with the drawings.

  2. #2
    Member
    Join Date
    2005-04
    Posts
    27
    Login to Give a bone
    0

    Default Re: Run a script that sets Variables from a button or drawing startup.

    Why not use a lisp routine instead? It can run when the drawing is opened.
    Just put it in your acaddoc.lsp.
    Last edited by steve.86586; 2006-02-20 at 01:59 PM.

  3. #3
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,657
    Login to Give a bone
    0

    Default Re: Run a script that sets Variables from a button or drawing startup.

    Hi Steve

    Please note I have *moved* this thread from the AutoCAD General forum to this one as I feel this particular Forum is a more appropriate place for such a topic.

    Thanks, Mike

    Forum Moderator

  4. #4
    Member
    Join Date
    2005-04
    Posts
    27
    Login to Give a bone
    0

    Default Re: Run a script that sets Variables from a button or drawing startup.

    That's kewl. I was just replying to the question and it just happened to be posted in the AutoCAD General Forum. But..if it's moved will the poster who needs the answer know where to go now?


    Thanks

  5. #5
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,657
    Login to Give a bone
    0

    Default Re: Run a script that sets Variables from a button or drawing startup.

    Quote Originally Posted by steve.86586
    But..if it's moved will the poster who needs the answer know where to go now?
    Hi

    Yes!

    Please see here ( RE: Linetypes with shapes - Error: bad definition at line... ) for an explanation.

    Mike

  6. #6
    All AUGI, all the time SRBalliet's Avatar
    Join Date
    2004-06
    Location
    Near Christiansburg, VA Looking for a closer job!
    Posts
    500
    Login to Give a bone
    0

    Default Re: Run a script that sets Variables from a button or drawing startup.

    Quote Originally Posted by steve.86586
    Why not use a lisp routine instead? It can run when the drawing is opened.
    Just put it in your acaddoc.lsp.
    I don't know how to write a lisp routine and don't have the time to learn it right now.

  7. #7
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,821
    Login to Give a bone
    0

    Default Re: Run a script that sets Variables from a button or drawing startup.

    Quote Originally Posted by srb
    Any better ideas?
    What steve said. Do it with "acaddoc.lsp"

    Quote Originally Posted by srb
    How about a script that will run each time I open a drawing?
    That's what "acaddoc.lsp" does, runs each time a drawing is opened. No, it's not a .scr file, but if you only know how to write script files, you could call your script file from "acaddoc.lsp"

    Just add a line like this (using your path/filename) to a file named "acaddoc.lsp" in the directory at the top of the support file search path.

    (command "._script" "\\\\server\\share\\directory\\your.scr")

    ...although setting sysvars is very easy in lisp. See below

    (setvar "varname" value)

    (setvar "hpname" "solid")
    (setvar "mtexted" "internal")
    (setvar "cmddia" 0)
    R.K. McSwain | CAD Panacea |

  8. #8
    All AUGI, all the time SRBalliet's Avatar
    Join Date
    2004-06
    Location
    Near Christiansburg, VA Looking for a closer job!
    Posts
    500
    Login to Give a bone
    0

    Default Re: Run a script that sets Variables from a button or drawing startup.

    I don't have a "acaddoc.lsp", but I do have a "acad2005doc.lsp". Are they used the same by the software?

  9. #9
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,821
    Login to Give a bone
    0

    Default Re: Run a script that sets Variables from a button or drawing startup.

    Quote Originally Posted by srb
    I don't have a "acaddoc.lsp", but I do have a "acad2005doc.lsp". Are they used the same by the software?
    No.

    "acad####doc.lsp" is a Autodesk supplied file. Do not modify it, or your changes may be lost during the next patch, repair, or upgrade.

    "acaddoc.lsp" is a user defined file, that AutoCAD will read, but not modify.

    More details at:
    http://support.autodesk.com/Getdoc.asp?ID=TS21336
    http://www.afralisp.co.za/lisp/custom.htm
    http://support.autodesk.com/Getdoc.asp?ID=TS28079
    R.K. McSwain | CAD Panacea |

  10. #10
    Member
    Join Date
    2005-04
    Posts
    27
    Login to Give a bone
    0

    Default Re: Run a script that sets Variables from a button or drawing startup.

    You don't necessarily have to have a acaddoc.lsp. I don't believe you have one straight outa the box so to speak. And that's ok, AutoCAD looks for it and if you don't have it then kewl....but if you do then it acts on it accordingly. If you don't have it by default then all you need do is create it and put it in the document path as rkmcswain indicated. Then when you open a drawing, AutoCAD looks for the acaddoc.lsp file automagicly and performs the routines that are defined in that document.


    In AutoCAD 2005...you click on the tools menu button at the top of your screen and select "options".
    That opens up a dialogue box, then select the "files" tab. Under the "files" tab you will see
    "support file search path" at the top of the list. What rkmcswain was saying was to insert your newly
    created acaddoc.lsp file at the top of that hierarchy.

    Steve
    Last edited by steve.86586; 2006-02-21 at 11:58 AM.

Similar Threads

  1. Omit sheet sets on startup
    By Wish List System in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2012-11-13, 04:12 PM
  2. startup script for acad version
    By Michael Coviello in forum Revit - API
    Replies: 3
    Last Post: 2008-08-07, 08:14 PM
  3. Script w/ System Variables & Info
    By OCD in forum AutoCAD Customization
    Replies: 4
    Last Post: 2008-01-11, 04:59 PM
  4. Is there a way to access selection sets in a script?
    By ahefner in forum AutoCAD Customization
    Replies: 36
    Last Post: 2007-06-07, 01:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •