See the top rated post in this thread. Click here

Results 1 to 5 of 5

Thread: Loading lisp code at start up

  1. #1
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Loading lisp code at start up

    Hi everyone,

    I have a few questions on coding and having my code load at start up.

    Background:

    I use a master .lsp files that has these two examples of code in them for all of the codes that we use.

    ;;CodeName.lsp
    (if (findfile (strcat lisp_path "CodeName.lsp"))
    (load (strcat lisp_path "CodeName.lsp"))
    )


    and

    ;;CodeName.fas
    (if (findfile (strcat lisp_path "CodeName.fas"))
    (load (strcat lisp_path "CodeName.fas"))
    )

    Then in my ACADDOC.lsp file I have this.

    (setq lisp_path "Z:\\CustomFiles\\")
    (if (findfile (strcat lisp_path "Customfiles.lsp"))
    (load (strcat lisp_path "Customfiles.lsp"))
    )

    I was in a class at AU that the speaker was showing a way to use a Autocom.lsp with the names of all your lisp files and this file will load from a Custom-menu.mnl file that you make.

    In this Autocom.lsp all you use is this for each of you codes.

    (autoload "CodeName" '("name to run the code"))

    Questions:

    1.) Is using the AutoCom.lsp file way a faster and/or easiser way to get AutoCAD to startup faster?

    2.) When using the AutoCom.lsp I can't get it to run any .FAS files, does anyone know how to make it load .FAS files?

    I would ask the speaker these questions but it looks to me that he only gives you one question and I used that up asking him about the things that I didn't need to use in his code example because I don't use ADT.

    Thanks,

    Kyle C.

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

    Default Re: Loading lisp code at start up

    (Autoload) just preloads the names of the commands, then loads the code it the command is executed. This saves a little time and memory, but unless you are loading some huge lisp files, I don't think it has a huge impact these days.

    Having said that, I do use (autoload) in our "acaddoc.lsp" file for lisp files that are used frequently enough to define (and not have to use APPLOAD), but not used every single session of AutoCAD.

    I have never tested it's actual impact on startup time, but we are fairly satisfied with the startup time (compared with OOTB installs of 2006, not R14) so it's a non-issue.

    For your FAS files, do this:

    Code:
    (autoload "mycode.fas" '("cmdName"))
    R.K. McSwain | CAD Panacea |

  3. #3
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Loading lisp code at start up

    rkmcswain,

    Thank you for the info.

    Kyle C.

  4. #4
    I could stop if I wanted to
    Join Date
    2003-05
    Posts
    335
    Login to Give a bone
    1

    Default Re: Loading lisp code at start up

    As for your questions about an mnl file, I use them to load our files at startup and it works great. If you use custom menus then all you have to do is name the mnl file the same name as your custom menu file and it will load if it's in one of your support paths.

    Here is an excerpt from our mnl file:
    Code:
    (load "Y:\\AutoCad 2006 ADT\\Configuration\\AutoLisp\\deloach_utilities_acad.lsp" '(princ))
    (load "Y:\\AutoCad 2006 ADT\\Configuration\\AutoLisp\\room_tools.lsp" '(princ))
    (load "Y:\\AutoCad 2006 ADT\\Configuration\\AutoLisp\\30x42.lsp" '(princ))
    (load "Y:\\AutoCad 2006 ADT\\Configuration\\AutoLisp\\att.lsp" '(princ))
    (load "Y:\\AutoCad 2006 ADT\\Configuration\\AutoLisp\\blank.lsp" '(princ))
    (load "Y:\\AutoCad 2006 ADT\\Configuration\\AutoLisp\\context.lsp" '(princ))
    Notice I included the entire path in this example, I do this just to eliminate the possibility of loading the wrong file.

    I was taught when I started to NEVER modify the AutoCad files, add a custom menu to load your tools. I know alot of people differ on this opinion and I'm not going to tell how to do yours I was just telling you about ours.

    Will

  5. #5
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Loading lisp code at start up

    Will,

    Thanks for your input.

    Kyle C.

Similar Threads

  1. Replies: 2
    Last Post: 2015-04-17, 04:00 PM
  2. Replies: 0
    Last Post: 2013-02-22, 12:20 AM
  3. problem loading lisp code
    By mdsalman2003 in forum AutoLISP
    Replies: 14
    Last Post: 2010-06-18, 08:23 PM
  4. Replies: 5
    Last Post: 2006-12-08, 03:20 AM
  5. Start Up Lisp Help
    By BCrouse in forum AutoLISP
    Replies: 7
    Last Post: 2005-04-20, 03:52 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
  •