ACADDOOC.LSP not loading all LISPs

ACADDOOC.LSP not loading all LISPs

KuriosCowboy
Enthusiast Enthusiast
1,176 Views
4 Replies
Message 1 of 5

ACADDOOC.LSP not loading all LISPs

KuriosCowboy
Enthusiast
Enthusiast

Over the weekend, my company moved servers, and completely screwed up my ACADDOC.LSP file, in term of the LISP locations I had loaded. All of the network paths changed, and where some drives were mapped, now they are not (now standard "\\network" location). After updating they file locations, one specific LISP wont autoload. When I use APPLOAD, it works fine. But I hate having to remember/use APPLOAD in every drawing file. All the other LISPs in the ACADDOC load/work fine (they are personally made, and on the C:). I even tried creating a copy to my local machine, and it still doesnt load.

 

PS: the LISP in question has not changed in months (so its not a code error in the LISP).

0 Likes
1,177 Views
4 Replies
Replies (4)
Message 2 of 5

cadffm
Consultant
Consultant
I think in this one Lisp is code that directly evaluted(?), i mean the content is not (only) define a function.
There are direct statements to run a funktion.
Example: Start a funcion or call a command, set a autocad variable.. is it right?

The acad(doc).lsp is not the place to do it if you will be sure that this works,
so you can have a timing problem.

Easy check:
Add (princ"aaaa") to the first line and
(princ"bbbbbbb") as last line.

Use the search function and search for John Uhden, i think thats the best thread to this:
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-a-lisp-run-automatically...

Sebastian

0 Likes
Message 3 of 5

KuriosCowboy
Enthusiast
Enthusiast

Thanks for the reply.

My issue is, it worked friday. My ACADDOC.LSP file code is as shown

 

(princ "\n Acaddoc.lsp START LOAD")

(load "C:\\Users\\Justin.Dowling\\Documents\\AutoCAD Stuff\\VPLOCK.lsp")

(load "C:\\Users\\Justin.Dowling\\Documents\\AutoCAD Stuff\\mt2ml.lsp")

(load "C:\\Users\\Justin.Dowling\\Documents\\AutoCAD Stuff\\ASDF.lsp")

(load "C:\\Users\\Justin.Dowling\\Documents\\AutoCAD Stuff\\DPLOT.lsp")

(princ "\n Acaddoc.lsp END LOAD")

All the files are in that location, and that file is in the SFSP. None of the files have changed. The only thing that changed is I coppied the last LISP (DPLOT.LSP) from the network location to the "AutoCAD Stuff" folder, and updated the file path in the ACADDOC.LSP. All the other LISPs run correctly, just not the DPLOT.

The error I get is that the command does not exist. After I APPLOAD, the command works perfectly. Im not sure why it wont autoload within the ACADDOC.LSP as it has in the past.

0 Likes
Message 4 of 5

cadffm
Consultant
Consultant

Important is the content of "DPLOT.lsp" (and perhaps of "ASDF.lsp" too: Make sure the last line works well - add (princ "asdf-end"))

 

Without access to your enviroment and data i can only guess 😞

Sebastian

0 Likes
Message 5 of 5

Shneuph
Collaborator
Collaborator

I think this would help with your original problem of the lisp files moving... This is how I learned to load lisp.  It's been a long time since I wrote this so I'm rusty with it.  I'm just sharing what is in my acaddoc.lsp file.  This is not the entire file.

 

There are 3 sections.  One for autoloading lisp functions.  One for demand loading lisp commands, and one for custom loading lisp commands.

 

Then, just put all the autoload functions and demandload commands in separate folders and it will find and load them all.  You simply would have had to change the path in 2 places in your acaddoc.lsp file if they moved.

 

Note: you'll want lisp that are not done or in progress in separate folders because they will fail to load if the code isn't correct.

 

Hope this helps you or someone else.

;===============================================================================
;Autoload Functions
(terpri)
(princ "\n===== Autoloading B******m Custom Functions ===========")
(Setq TLV-LineLength 1)
;;;THIS AUTOLOAD FUNCTION WILL LOAD ANY LISP INSIDE THE SPECIFIED FOLDER INTO YOUR
;;;CURRENT AUTOCAD SESSION.  FUNCTIONS THAT WILL BE USED IN OTHER LISP SHOULD BE
;;;AUTOLOADED.
(foreach x (vl-directory-files "T:\\CAD Support\\LISP\\AutoLoad" "*.lsp")
  (if (> (strlen x) TLV-LineLength)
    (Setq TLV-LineLength (strlen x))
    );if
  );foreach
(Setq TLV-LineLength (- TLV-LineLength 5))
(terpri)
(foreach x (vl-directory-files "T:\\CAD Support\\LISP\\AutoLoad" "*.lsp")
  (Setq TLV-DashString "-")
  (repeat (- TLV-LineLength (strlen x))
    (Setq TLV-DashString (strcat TLV-DashString "-"))
    );repeat
  (princ (Strcat "Loading " (strcase x) ": "))
  (setq TLV-LoadReturn (load (strcat "T:\\CAD Support\\LISP\\AutoLoad\\" x) "Fail!"))
  (cond
    (
     (= TLV-LoadReturn nil)
     (if (> (strlen (strcat "Loading " x ": " TLV-DashString " LOAD FAILED!!")) 80)
       (progn
	 (terpri)
	 (princ "                                                    ---------- LOAD FAILED!!")
	 );progn
       (princ (strcat TLV-DashString " LOAD FAILED!!"))
       );if
     );cond1
    (;cond2
     (= TLV-LoadReturn "Fail!")
     (princ (strcat x "FAILED - File not found!"))
     );cond2
    (;cond3
     TLV-LoadReturn
     (princ tlv-dashstring)
     (princ TLV-LoadReturn)
     );cond3
    );cond
  (terpri)
  );foreach


;===============================================================================
;Auto Demandload Commands
(terpri)
(princ "\n===== Demand-loading B******m Custom Commands =========")
;;;THIS DEMANDLOAD FUNCTION WILL DEMANDLOAD ANY LISP INSIDE THE SPECIFIED FOLDER
;;;INTO YOUR CURRENT AUTOCAD SESSION.  COMMAND LISPS CAN BE DEMAND LOADED SO THAT
;;;THE ONLY LOAD WHEN THEY ARE USED. !!!DEMAND LOAD FILE NAMES MUST MATCH THE
;;;DEMAND LOAD COMMAND NAME!!!
;;;i.e. "C:Drawabunchoflines" goes in "Drawabunchoflines.lsp"
(foreach x (vl-directory-files "T:\\CAD Support\\LISP\\DemandLoad" "*.lsp")
  (if (not (autoload x (list x)))
    (princ (strcat "\nDemand-Loading: " x))
    );if
  );foreach
(terpri)
(princ "\n* Demand-Loaded Commands will be loaded on first use.")
(terpri)

;Manual Demandload Functions <-- Manually loading multiple functions defined in 1 file
(autoload "TLC-View_UCS.LSP" (list "TLSK-View_Top"
"TLSK-View_Bottom"
"TLSK-View_Front"
"TLSK-View_Back"
"TLSK-View_Left"
"TLSK-View_Right"
"TLSK-View_SWIso"
"TLSK-View_SEIso"
"TLSK-View_NWIso"
"TLSK-View_NEIso"
"TLSK-UCS_Top"
"TLSK-UCS_Back"
"TLSK-UCS_Front"
"TLSK-UCS_Left"
"TLSK-UCS_Right")
);autoload
---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
0 Likes