Lisp

Lisp

Anonymous
Not applicable
445 Views
9 Replies
Message 1 of 10

Lisp

Anonymous
Not applicable

I have a "Quick Keystroke Command" lisp routine that I am trying to load into Autocad using the appload window and load it by double clicking on the file and also adding it to the start up contents. The file doesn't load but ,aybe 50% of the commands. What is stopping this lisp routine from being fully loaded?

 

Thanks for responses!

Greg

0 Likes
446 Views
9 Replies
Replies (9)
Message 2 of 10

Kent1Cooper
Consultant
Consultant

Is there any error message?

 

Without a careful review, it's hard to say whether, for example, some invalid definition might be stopping it part-way through.  But I would also think you could shorten it, because a number of those look the same as default command aliases already in the ACAD.PGP file.  You could also use that for some of them that are not already given your preferred shortcuts [all those that just call up a command, without built-in feeding-in of some option(s)],  You can change the assignments of aliases in the .PGP, but make sure you don't duplicate any that are already there for other commands, unless you change those to something else or remove them.

Kent Cooper, AIA
0 Likes
Message 3 of 10

hmsilva
Mentor
Mentor

You have an extra right paren in

 

(defun c:lo () (prompt "Layer Off\n") (command "_layoff") (prin1))
(prin1))

 

Henrique

EESignature

0 Likes
Message 4 of 10

dbroad
Mentor
Mentor

Debugging method.

1) Open file in vlide.  Select Tools -> Check Text in Editor.  In this case it reports an extra parenthesis.

2) Double click the error report and it sends to the extra parenthesis.  In this case you have an extra (princ)) on line 72.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 5 of 10

Anonymous
Not applicable

So what I did was went thru my lips file and deleted all of the duplicate call outs and saved one at a time. When I deleted ;***
(defun c:zl () (prompt "Zoom Limits\n")
(command ".zoom" "w" (getvar "limmin") (getvar "limmax"))
 (prin1))

 

Then the lisp routine works perfectly

 

Thanks for your responses!

0 Likes
Message 6 of 10

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... When I deleted ;***
(defun c:zl () (prompt "Zoom Limits\n")
(command ".zoom" "w" (getvar "limmin") (getvar "limmax"))
 (prin1))

 

Then the lisp routine works perfectly

....


I wouldn't think you'd need to get rid of that one to make the rest of them work.  I have a nearly identical command defined in my acaddoc.lsp [except without the (prompt) -- it just does it], which I use all the time.  Another slight difference is that mine doesn't have the "w" option specified -- Zoom assumes that if no other option is specified, so you can simply give it two points.

Kent Cooper, AIA
0 Likes
Message 7 of 10

Anonymous
Not applicable

Well, I didn't see anything in my lisp file to cause any problems. It wasn't until I deleted that particular command that the lisp routine started working.

0 Likes
Message 8 of 10

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

Well, I didn't see anything in my lisp file to cause any problems. It wasn't until I deleted that particular command that the lisp routine started working.


That makes me wonder whether the file may have been edited, in part or at some time, using a Word Processor or Rich-Text editor rather than a plain-text editor.  I believe certain characters can "survive" in something like MS Word when saved as an ASCII file with a certain amount of "intelligence" [such as double-quotes, which differentiate themselves in Word between opening and closing ones, and apostrophes] that AutoLISP won't be happy with.  Some things like that show up as little rectangles when such a file is opened in a plain-text editor, but I think some may be able to look like their plain-text equivalents without really being that way.  So I'm curious -- if you edit that command in a truly plain-text editor like Notepad, and delete all the double-quotes and re-type them to makre sure they're really plain-text ones, and re-insert it into the larger file, does it work?

Kent Cooper, AIA
0 Likes
Message 9 of 10

Anonymous
Not applicable

Well, that wouldn't be the problem because I have been the only editor of this lisp routine and I have only opened and edited in notepad

0 Likes
Message 10 of 10

stevor
Collaborator
Collaborator

From your attachement, I get the same as HMS,

to lose the extra right paren, replace:

;***
(defun c:lo () (prompt "Layer Off\n") (command "_layoff") (prin1))
(prin1))
;***

with:

;***
(defun c:lo () (prompt "Layer Off\n") (command "_layoff") (prin1))
;***

S
0 Likes