Jump to content

How to auto load LISP files?


azman

Recommended Posts

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • irneb

    5

  • Dj_T_Rex2002

    5

  • azman

    2

  • nod684

    2

Add them to the startup suite.

I'm at home right now so I can't lookup the exact pulldown to look under for it.

 

but if you search the help file for startup suite I bet you can find it prety easily.

 

edit - thanks PS that's what I was talking about.

Link to comment
Share on other sites

Otherwise if you want the lisp files loaded on everyones pc throughout a office just add it to the customisation file

 

Same way you can add toolbars and menus to a custom cui file you can load lisp files.

 

Then just load this one custom cui file on each pc using the "cuiload" command

Link to comment
Share on other sites

  • 2 months later...
Guest Alan Cullen

As is typical, many ways to skin the acad cat.

 

Another way is to add the load command to your acaddoc.lsp file.

 

e.g. .....

 

(load "C:/ACADLISP/chtext.LSP")

Link to comment
Share on other sites

  • 2 years later...
  • 2 years later...

Ok question in regards on adding LISPs ... I have them in the Startup Suite and have them loaded. It works just fine in my computer but does not work on my co-workers computer. We both have 2014. It shows up File Search Path just fine and also it is in the Startup Suite but says "Unknown command" ... when we click the "Load" it works just fine ... please help :(

Link to comment
Share on other sites

Yes, I did the same think on her computer that I did on mine. Mine AutoLoads the LISPs at start up but hers, we have to manually re-select them and click Load in order to work. It is in her Startup Suite and same C:\ directory where her CAD support folder is.

Link to comment
Share on other sites

A new problem (I think since 2013) is that ADesk introduced a TrustedPaths setting. Only files in those folders are allowed to be loaded. You can change this behaviour using the SecureLoad variable, but that simply disables the "anti-virus" inside ACad. A whole discussion about this: http://www.theswamp.org/index.php?topic=44322.15

 

Personally, I don't like using the Startup Suite that much. It's more work to get the same files to load on different PC's and/or upgrades. http://www.cadtutor.net/forum/showthread.php?77144-AutoCAD-quot-fas-quot-file-autoloading-in-startup

Link to comment
Share on other sites

I have never liked the startup suite. Years ago there were reports that it was 'unreliable'. Not sure if that is factually true or not. I have always used acaddoc.lsp file with never a problem.

Link to comment
Share on other sites

Years ago there were reports that it was 'unreliable'. Not sure if that is factually true or not.
I think you might mean this: http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Startup-Suite/td-p/893877

 

That is a way to "automate" the setup so you don't have to redo the startup suite on every PC manually. But for some reason if you edit the registry outside of the AppLoad command, it doesn't load those files you've added to the StartUp Suite - you have to start the AppLoad command so it recognises them from the registry setting before it actually "starts" to load them. Painful, and negates the "automaticness" of setting up more than one PC to load the same files.

 

So yes the easiest hassle-free method is to go with acaddoc.lsp. There are many others, but for simplicity that one solves most use cases.

Link to comment
Share on other sites

Ok, I did not understand the whole registry key modification ... is there a way to add Auto Load in the actual LISP to start up when AutoCAD opens? An example of a lisp I have is:

 

(DEFUN C:BF (/ SS)

(PRINC "\NSELECT OBJECT TO BRING TO FRONT: ")

(SETQ SS (SSGET))

(COMMAND "._DRAWORDER" SS "" "F")

(PRINC)

)

(DEFUN C:BB (/ SS)

(PRINC "\NSELECT OBJECT TO BRING TO BACK: ")

(SETQ SS (SSGET))

(COMMAND "._DRAWORDER" SS "" "B")

(PRINC)

)

Link to comment
Share on other sites

A new problem (I think since 2013) is that ADesk introduced a TrustedPaths setting. Only files in those folders are allowed to be loaded. You can change this behaviour using the SecureLoad variable, but that simply disables the "anti-virus" inside ACad. A whole discussion about this: http://www.theswamp.org/index.php?topic=44322.15

 

Personally, I don't like using the Startup Suite that much. It's more work to get the same files to load on different PC's and/or upgrades. http://www.cadtutor.net/forum/showthread.php?77144-AutoCAD-quot-fas-quot-file-autoloading-in-startup

 

irneb am also having the same problem. I'm using 2013.

there is no trustedpaths and secureload sysvar on 2013.

Link to comment
Share on other sites

irneb am also having the same problem. I'm using 2013.

there is no trustedpaths and secureload sysvar on 2013.

According to this, it's added into 2013 with SP1. 2014 comes standard with TrustedPaths.
Link to comment
Share on other sites

Firstly, please use CODE tags when posting codes ... let me do that for you.

Ok, I did not understand the whole registry key modification ... is there a way to add Auto Load in the actual LISP to start up when AutoCAD opens? An example of a lisp I have is:

 

(DEFUN C:BF (/ SS)
 (PRINC "\NSELECT OBJECT TO BRING TO FRONT: ")
   (SETQ SS (SSGET))
     (COMMAND "._DRAWORDER" SS "" "F")
       (PRINC)
)
(DEFUN C:BB (/ SS)
 (PRINC "\NSELECT OBJECT TO BRING TO BACK: ")
   (SETQ SS (SSGET))
     (COMMAND "._DRAWORDER" SS "" "B")
       (PRINC)
)

Secondly, where is that code saved? Some arbitrary LSP file?

 

All that's needed is for you to create/modify a file named ACADDOC.LSP (note if it doesn't exist don't use any others which look similar, make your own one). Create it using Notepad/VLIDE (same as any other LSP file). Save it in a folder which is listed on your support paths or add its folder to your support paths.

 

You can either just paste that code direct into the ACADDOC.LSP file you've created. Or if it's already in a file (say it's called DRAWORDER.LSP and saved in a folder C:\MyLisps\) you add this one line into ACADDOC.LSP:

(load "C:/MyLisps/DrawOrder" "Error loading DrawOrder Lisp")

Note the path is only needed if acad cannot find it otherwise. I'm showing forward slashes in this case, you can use Windows' default back-slash, but then you need to double them like so:

(load "C:\\MyLisps\\DrawOrder" "Error loading DrawOrder Lisp")

 

If the folder in which that LSP file is saved is also in your support folders, then that line becomes easier - no more need to tell load where the file is:

(load "DrawOrder" "Error loading DrawOrder Lisp")

 

If you're using 2013-SP1 or 2014 you might also need to add all the folders where all your LSP files are saved to the TrustedPaths system variable. See my other post and the reply to nod684.

Link to comment
Share on other sites

Irneb thanks for the advice. You mean to create a LISP inside the folder where we keep the other LISPs? Or can that line "

(load "C:/MyLisps/DrawOrder" "Error loading DrawOrder Lisp")

" be added to the actual DrawOrder.LSP?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...