Automatic Loading of AutoLISP Files

Discussion in 'AutoCAD' started by Sunburned Surveyor, Oct 28, 2004.

  1. I usually load AutoLISP files using the "APPLOAD" command. Is there a way to load a predefined list of LISP routines when AutoCAD is fired?

    Thanks,

    Sunburned Surveyor
     
    Sunburned Surveyor, Oct 28, 2004
    #1
  2. Sunburned Surveyor

    CJ Follmer Guest

    open or make a file called acaddoc.lsp, in it put

    (load "mylisp1")
    (load "mylisp2")

    or you can use autoload like this

    (autoload "mylisp" '("mycommand"))

    That makes loading quicker if you have lots of routines.

    cj


    to load a predefined list of LISP routines when AutoCAD is fired?
     
    CJ Follmer, Oct 28, 2004
    #2
  3. Sunburned Surveyor

    SkintSubby Guest

    You could also add the lisps to the start-up suite.
     
    SkintSubby, Oct 28, 2004
    #3
  4. Sunburned Surveyor

    Tom Smith Guest

    You could also add the lisps to the start-up suite.

    That's a non-programmatic way to do things, but it makes it a lot more
    difficult to share the setup between computers, or to copy it to a laptop or
    home machine. Putting all the load statements in a file that's automatically
    loaded, like acaddoc.lsp or an mnl file, makes the setup more easily
    portable.
     
    Tom Smith, Oct 28, 2004
    #4
  5. Thanks for the responses Tom and Scott.

    Where do I locate the acaddoc.lsp file?

    The Sunburned Surveyor
     
    Sunburned Surveyor, Oct 28, 2004
    #5
  6. Sunburned Surveyor

    Tom Smith Guest

    Where do I locate the acaddoc.lsp file?

    It's not provided by Acad. You have to create it, with something like
    NotePad or with VLIDE. Put it somewhere on your Acad search path. Look in
    the developer documentation for more details.

    If you haven't done so already, I'd suggest putting all your customizations
    in one or more "custom" folders, not in those installed by Acad, and put
    your folder(s) earlier on your search path than theirs. Keeping a
    distinction between standard Acad-supplied files vs your customizations will
    make it easier to maintain and to upgrade to the next version.
     
    Tom Smith, Oct 28, 2004
    #6
  7. Hi Sunburned Surveyor,

    In addition to the other suggestions what I have done that seems to work is
    this: I created a acaddoc.lsp file that loads another file (along with other
    things) that contains nothing but autoload statements with this statement
    (look up autoload in help)...

    (load "SCMAutoL") ; SCM AutoLoad Routines

    My SCMAutoL.lsp file contains lots of statements like the following which
    includes a short help reminder of what the program does:

    (autoload "blocktools" ; Miscellaneous Tools for Editing Blocks
    '("BI" ; Block Insert, select from dialog list of blocks in
    current file
    "BU" ; Block Update/replace, if not in path allows search
    "BX" ; Block Mirror about the X-Axis
    "BY" ; Block Mirror about the Y-Axis
    "NBD" ; Replace Block selected with another, Dialog
    selection
    "RBL")) ; Replace Block selected with another selected Block

    Then I print the file for those that want a quick help file for all these
    programs. I also save this to a SCMAutoL.txt file each time I update it and
    then that file is accessible with a macro that reads it using IE for an
    updated quick help. I would like to just read the lsp file but can't figure
    out how (any suggestions out there that work?).

    All of our customized files are put into a network folder we call
    H:\AutoCAD2005 and this is added to our AutoCAD search path on all machines.
    Of course, BlockTools.lsp is one of them which contains all the programs
    listed.

    Anyway, seems to work. And provides a way to provide a quick help file.
    Hope this helps some.

    Arnold Williams
     
    Arnold Williams, Oct 29, 2004
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.