Results 1 to 6 of 6

Thread: AutoLoad/Run AutoLISP

  1. #1
    Member
    Join Date
    2004-11
    Posts
    6
    Login to Give a bone
    0

    Cool AutoLoad/Run AutoLISP

    I wrote a simple lisp to gather info from a layout dwg then automatically open another std. dwg. After the std. dwg is open i call another lisp to use the info from the layout dwg. Is there anyway to load and run the second lisp automatically when that dwg opens?
    Attached Files Attached Files

  2. #2
    100 Club lance.81922's Avatar
    Join Date
    2005-01
    Location
    Santa Fe, NM
    Posts
    176
    Login to Give a bone
    0

    Default Re: AutoLoad/Run AutoLISP

    Yes, you should be able to load and run your second routine if you use reactors . You need to set up the :VLR-DwgFile-Opened reactor to test to be sure the right drawing was opened, and then load and run the second file with the reactor callback routine.

  3. #3
    Member
    Join Date
    2002-04
    Posts
    6
    Login to Give a bone
    0

    Default Re: AutoLoad/Run AutoLISP

    Quote Originally Posted by ironwood1957
    I wrote a simple lisp to gather info from a layout dwg then automatically open another std. dwg. After the std. dwg is open i call another lisp to use the info from the layout dwg. Is there anyway to load and run the second lisp automatically when that dwg opens?
    if you want your lisp to run each time autocad starts, or opens a new document, then load your lisp file into Acaddoc.lsp.
    Or create a start up lisp, or a script to run with autocad.
    ... there are several methods, but more or less go around what I said.

    Ciao

  4. #4
    100 Club lance.81922's Avatar
    Join Date
    2005-01
    Location
    Santa Fe, NM
    Posts
    176
    Login to Give a bone
    0

    Default Re: AutoLoad/Run AutoLISP

    If the intention is to run the second file only when a particular drawing opens, reactors are the best way. ACADDOC loads with any drawing regardless of which one it is. I suppose you could test for DWGNAME and then conditionally load the file from ACADDOC. Reactors are fun, though. I really like using them to enhance the possibilities of VL/AutoLISP. If it were me, I'd try it just to learn how they work.

  5. #5
    Member
    Join Date
    2004-11
    Posts
    6
    Login to Give a bone
    0

    Default Re: AutoLoad/Run AutoLISP

    Quote Originally Posted by lance.81922
    If the intention is to run the second file only when a particular drawing opens, reactors are the best way. ACADDOC loads with any drawing regardless of which one it is. I suppose you could test for DWGNAME and then conditionally load the file from ACADDOC. Reactors are fun, though. I really like using them to enhance the possibilities of VL/AutoLISP. If it were me, I'd try it just to learn how they work.
    thanks lance.81922, I am looking at reactors now... but how do I attach/save a reactor to a dwg? I typed the following at the command line, (vlr-dwg-reactor nil '((:vlr-dwgFileOpened . "bracing2"))) saved the dwg, but when I open the dwg again the reactor was no longer there? BTW "bracing2" is my command line call to start "vla_bracing2.lsp...should this work?

  6. #6
    100 Club lance.81922's Avatar
    Join Date
    2005-01
    Location
    Santa Fe, NM
    Posts
    176
    Login to Give a bone
    0

    Default Re: AutoLoad/Run AutoLISP

    You can make reactors persistent (hint) in a drawing, but that's actually not what you need. There are different types of reactors -- command reactors, which run during an AutoCAD session and fire when their command runs; database reactors, which run when you change the database (like adding objects); and drawing reactors, which fire with events like opening a drawing. The drawing type is what you want. You don't need to actually put the reactor in the drawing -- just set it up before the drawing is opened with a routine that creates the reactor, which is in turn loaded by your ACADDOC.LSP file. Then, when a drawing is opened, the reactor fires. Your callback routine then should check to see if the drawing is the one you're looking for. If so you can load/run your second file.

Similar Threads

  1. AutoLoad?
    By m.mason in forum AutoLISP
    Replies: 7
    Last Post: 2009-11-02, 11:12 AM
  2. Autoload Lisp routines together
    By ccowgill in forum AutoLISP
    Replies: 9
    Last Post: 2006-04-05, 06:26 PM
  3. Autoload in VBA Manager
    By scott.ferguson.99233 in forum VBA/COM Interop
    Replies: 3
    Last Post: 2005-11-11, 06:33 AM
  4. AutoLOAD? From where?
    By methost in forum AutoCAD General
    Replies: 5
    Last Post: 2005-02-01, 08:10 PM
  5. autoload menu
    By inner69923 in forum VBA/COM Interop
    Replies: 5
    Last Post: 2004-07-16, 01:14 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
  •