Jump to content

Recommended Posts

Posted

I'm completely clueless about Lisp. Unfortunately, the guy in our office who kept things running ran off to join the circus, taking all of his toys with him, and some of us are trying to upgrade while still maintaining our macros. Any help you can lend would be gratefully apprectiated.

 

Previously in Acad2007, he had us use copy this Acaddoc.lsp file to all our support directories (Acad, Land Desktop, Civil3d). We also copied all our lisp routines to our desktops/laptops. The idea was that the network drive would always be current and updated, but if we were away from the network we could still run things from our stations.

 

Unfortunately, I haven't been able to get this to work after upgrading to Acad2009 and Acad2011 Civil3D, and don't know what I am doing wrong.

 

Here's the acaddoc.lsp we used:

 

;;;    ACADDOC.LSP Created to Load Earth Tech Routines
;;;

(setq S::STARTUP (append S::STARTUP AecCStartup))
(princ "Starting Load")
(princ "Network Check...  ");
 (if (findfile "L:/library/cadmasters/acadsta/acad/lisp/network.up")
   (progn
     (princ "OK.\n")
     (defun ETload (parm / full_filename)
       (setq full_filename (strcat "L:/library/cadmasters/ACADSTA/ACAD/LISP/" parm))
       (if (findfile (strcat full_filename ".lsp"))
         (load full_filename)
         (princ (strcat "AutoLISP File (" full_filename ") Not Found\n"))
       );End if
       (princ)
     );End def
   );Pend
   (progn
     (princ "\nServer DOWN...  Resetting LISP To C: Drive...  ")
     (getstring "Press <RETURN> To Acknowledge Problem: ")
     (defun whload (parm / full_filename)
       (setq full_filename (strcat "C:/ACAD/LISP/" parm))
       (if (findfile (strcat full_filename ".lsp"))
         (load full_filename)
         (princ (strcat "AutoLISP File (" full_filename ") Not Found\n"))
       );End if
       (princ)
     );End def
   );Pend
 );End if
 ;--  Load Earth Tech Standard LISP Routines
   (ETload "Earth-Tech")

 ;--  Set All Default Variables
 (setvar "UCSICON" 0)
 (setvar "CMDECHO" 0)
(princ)

 

I know that it is looking for Earth-Tech.lsp. It is loaded at C:/Acad/Lisp. I can print it out if need be.

 

Here's the error that I get:

 

; error: no function definition: ETLOAD
AutoCAD menu utilities loaded.Starting LoadNetwork Check...
Server DOWN...  Resetting LISP To C: Drive...  Press <RETURN> To Acknowledge 
Problem: *Cancel*
; error: Function cancelled

 

and the macros won't work. I suspect that I have something filed in the wrong location, but I can't tell what or where.

 

Quite frankly, I really don't need to look to the network for the routines, and would be happy to run it only off my laptop, so if you want to suggest eliminating that network check, and how to get rid of it, that works for me. Most of us are on laptops now and able to work away from the network, so that's just not that important now.

 

I'd be glad for any suggestions, and can try to answer anything I can about where the files are located, or their contents.

 

Thank you.

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    6

  • GWelch

    5

  • alanjt

    3

  • resullins

    3

Top Posters In This Topic

Posted

Hi GWelch,

 

If you merely want to load a LISP file from a known location on your laptop, something like this would suffice:

 

(load "C:\\YourFolder\\YourLISP.lsp" "Failed to Load YourLISP")

Posted

(ETload "Earth-Tech")

 

That line doesn't mean anything as far as I know. Someone tell me if I'm wrong. But from what I can tell, the error is telling you that you're telling something to "ETLoad," but that's not a valid LISP command.

 

Try changing that line to (load "Earth-Tech")

 

Reload, restart AC, and try again.

Posted

GWelch,

obviously there is no file with the name "network.up" in this location: "L:/library/cadmasters/acadsta/acad/lisp/". It directs your program not to define "ETLOAD" function.

I think the clue is finding the mentioned file and putting it in the respective folder.

Posted
(ETload "Earth-Tech")

 

That line doesn't mean anything as far as I know. Someone tell me if I'm wrong. But from what I can tell, the error is telling you that you're telling something to "ETLoad," but that's not a valid LISP command.

 

Try changing that line to (load "Earth-Tech")

 

Reload, restart AC, and try again.

 

resullins, ETLoad is defined in a conditional manner in the code. The problem is due to lack of positive condition of: (if (findfile "L:/library/cadmasters/acadsta/acad/lisp/network.up") ...

Posted

Once you determined what LSP(s) file you require, use APPLOAD and Startup Suite to have them load automatically for each AutoCAD session.

Posted

Ahh.... I see what you're saying. Now... here's a question, in the error, it looks like GWelch isn't connected to the server. It was trying to look for the lsp on the C: drive....

 

I see you're right about it not finding the proper file to load the ETload command.... but maybe it's cause there was no connection to the server?

 

@Gwelch: I'd agree that you need to find that file though... I'm just trying to understand the rest of the code.

Posted
Once you determined what LSP(s) file you require, use APPLOAD and Startup Suite to have them load automatically for each AutoCAD session.

 

The StartupSuite is known to have bugs in some versions - it is far more reliable to use the ACADDOC.lsp to load programs on startup.

 

Ahh.... I see what you're saying. Now... here's a question, in the error, it looks like GWelch isn't connected to the server. It was trying to look for the lsp on the C: drive....

 

I see you're right about it not finding the proper file to load the ETload command.... but maybe it's cause there was no connection to the server

 

Resullins, here is a short explanation of the flow of the code:

 

(setq S::STARTUP (append S::STARTUP AecCStartup))
[color=green];; Unknown, since we don't know what the AecCStatup function is.[/color]

(princ "Starting Load")
(princ "Network Check...  ")

(if (findfile "L:/library/cadmasters/acadsta/acad/lisp/network.up")
[color=green]  ;; If the above file is found:[/color]
 (progn
   (princ "OK.\n")
   
   (defun ETload (parm / full_filename)      
     (setq full_filename (strcat "L:/library/cadmasters/ACADSTA/ACAD/LISP/" parm))
     (if (findfile (strcat full_filename ".lsp"))
       (load full_filename)
       (princ (strcat "AutoLISP File (" full_filename ") Not Found\n"))
     )
     (princ)
   )
[color=green]    ;; Define the 'ETload' function as above[/color]

 )
 (progn
   (princ "\nServer DOWN...  Resetting LISP To C: Drive...  ")
   (getstring "Press <RETURN> To Acknowledge Problem: ")

[color=green]    ;; Else define a 'whload' function as follows:[/color]
   
   (defun whload (parm / full_filename)
     (setq full_filename (strcat "C:/ACAD/LISP/" parm))
     (if (findfile (strcat full_filename ".lsp"))
       (load full_filename)
       (princ (strcat "AutoLISP File (" full_filename ") Not Found\n"))
     )
     (princ)
   )
   
 )
)

[color=green];; However, the ETLoad function is called anyway, regardless of whether the above
;; condition is met.[/color]

(ETload "Earth-Tech")

The problem could be fixed by renaming the 'whload' function to 'ETload'.

Posted
The problem could be fixed by renaming the 'whload' function to 'ETload'.

 

I'll try that.

 

Reload, restart AC, and try again.

 

 

If my cluelessness was not completely evident by now, how does one reload acaddoc.lsp? Will restarting Acad alone take care of that?

Posted

@Gwelch: Yup. Everytime you start AC, it finds and loads that file.

Posted
The problem could be fixed by renaming the 'whload' function to 'ETload'.

 

And that seems to have solved the problem. As an explanation, my company once had the initials "WH", and this is a legacy from then. I'll play around with this a bit more to make sure that is still fully functional, but it sure seems to be right now.

 

Thanks to everyone, and have a great weekend.

Posted

I would say though, if you don't need the 'network' check, the whole code could be replaced with just:

 

(load "C:\\ACAD\\LISP\\Earth-Tech.lsp" "Earth-Tech Failed to Load")

Posted

It would be better practice and make much more sense to add the path to your support path list (in options - can easily be accomplished with a small bit of code) and just use (load "File.LSP" "fail"). Then, in the future, the only thing that has to be tweaked is the support path, instead of worrying with changing lots of code. Continuing this practice over many routines could yield you a lot of work fixing code, if your LISP destination folder/path ever changed.

Posted
I would say though, if you don't need the 'network' check, the whole code could be replaced with just:

 

(load "C:\\ACAD\\LISP\\Earth-Tech.lsp" "Earth-Tech Failed to Load")

 

I know that I hadn't previously posted the contents of Earth-tech.lsp. In looking at that file, most of the lines contain a reference to ETLOAD, such as:

 

(defun c:cbc_util () (ETload "cbc_util")) 
 (defun c:srlayer () (ETload "srlayer"))
 (defun c:BATT () (ETload "BATT"))  
 (defun c:WD_END () (ETload "WD_END"))
 (defun c:WD_FACE () (ETload "WD_FACE"))
 (defun c:store () (ETload "store"))
 (defun c:ms2ps () (ETload "ms2ps"))
 (defun c:rpoly () (ETload "rpoly"))
 (defun c:settxt () (ETload "settext"))

 

etc... So am I right in thinking I need to keep some of that code to define ETLOAD?

Posted

I would agree with Alan and either add the folder containing your LISPs as a Support Path, or put all the LISP files in an existing Support Path.

 

Then, the ETLoad function could be as simple as:

 

(defun ETLoad ( file )
 (load (strcat file ".lsp") (strcat file " failed to load"))
)

 

This way, you can control the LISP source folder from one place and needn't worry about changing code in the future.

Posted
I know that I hadn't previously posted the contents of Earth-tech.lsp. In looking at that file, most of the lines contain a reference to ETLOAD, such as:

 

(defun c:cbc_util () (ETload "cbc_util")) 
 (defun c:srlayer () (ETload "srlayer"))
 (defun c:BATT () (ETload "BATT"))  
 (defun c:WD_END () (ETload "WD_END"))
 (defun c:WD_FACE () (ETload "WD_FACE"))
 (defun c:store () (ETload "store"))
 (defun c:ms2ps () (ETload "ms2ps"))
 (defun c:rpoly () (ETload "rpoly"))
 (defun c:settxt () (ETload "settext"))

 

etc... So am I right in thinking I need to keep some of that code to define ETLOAD?

Sounds to me like you need to explore the autoload function... Load/AutoLoad Usage

Posted
I would agree with Alan and either add the folder containing your LISPs as a Support Path, or put all the LISP files in an existing Support Path.

 

Then, the ETLoad function could be as simple as:

 

(defun ETLoad ( file )
 (load (strcat file ".lsp") (strcat file " failed to load"))
)

 

This way, you can control the LISP source folder from one place and needn't worry about changing code in the future.

BTW, the file extension is not required for load or autoload. I see no reason for a subfunction.
Posted
Sounds to me like you need to explore the autoload function... Load/AutoLoad Usage

 

Ditto (again), and if you need help creating the Autoload statements, or want even more info - see the links I supplied earlier in the thread. :)

Posted
Then, the ETLoad function could be as simple as:
Simple to a Quantum Mechanic, perhaps... I definitely need to do a little studying this weekend.

 

Sounds to me like you need to explore the autoload function... Load/AutoLoad Usage
Sounds to me I'm about to fall down the rabbit hole if I go one more step.

 

Okay, what the heck...

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...