Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error with if-then lisp

Status
Not open for further replies.

Volk359

Technical User
Jun 30, 2004
395
0
0
US
Hello,

The lisp I wrote is to plot a file (to disk) depending on whether the drawing is in model space or paper space. It works fine except I get an error after it runs:

; error: no function definition: nil

Can anyone tell me why?
 
Oops, suppose a little coding would help:

Code:
  (if (= (getvar "tilemode") 1)
    ((command "plot" "yes" "" "CAL File Generator300dpi.pc3" "ARCH D (36.00 x 24.00 Inches)" "inches" "landscape" "no" "extents" "fit" "center" "yes" "BPXA.ctb" "yes" "no" "" "yes" "yes");; then plot ms
    );; end then
    ((command "plot" "yes" "" "CAL File Generator300dpi.pc3" "ARCH D (36.00 x 24.00 Inches)" "inches" "landscape" "no" "extents" "fit" "center" "yes" "BPXA.ctb" "yes" "no" "no" "no" "" "yes" "yes");; else plot ps
    );; end else
  );; end if

Thanks
 
I would guess your syntax does quite match the prompts. Examine what gets reported to the command line and check for mis-matches/errors.(set CMDECHO to 1 to see).
 
Hmm.. ran fine as a script and I double checked the syntax and there's no errors. As said before the routine runs fine and completes the plot as it's supposed to but I get this irritating little error.

BTW, here's the entire routine:

Code:
(command "expert" 2)
(command "filedia" 0)
  (if (= (getvar "tilemode") 1)
    ((command "plot" "yes" "" "CAL File Generator300dpi.pc3" "ARCH D (36.00 x 24.00 Inches)" "inches" "landscape" "no" "extents" "fit" "center" "yes" "BPXA.ctb" "yes" "no" "" "yes" "yes");; then plot ms
    );; end then
    ((command "plot" "yes" "" "CAL File Generator300dpi.pc3" "ARCH D (36.00 x 24.00 Inches)" "inches" "landscape" "no" "extents" "fit" "center" "yes" "BPXA.ctb" "yes" "no" "no" "no" "" "yes" "yes");; else plot ps
    );; end else
  );; end if
(command "filedia" 1)
(command "expert" 0)

I just realized that it's not resetting FILEDIA and EXPERT so it must be bombing out before it gets there.
 
I'm surprised it runs, because..

...this doesn't look good:
((command "plot" etc...

...and...
'else plot ps'
you have that inside parentheses

should be only one parenthesis before the 'command', should have got some error message upon loading?


 
Nope, no error. I don't know if removing the comments helped but there are extra parens arounf the "then"/"else" which I removed and it runs fine now. Thanks for pointing me in the right direction.

BTW, I thought comments were allowed anywhere as long as they were the last thing on that particular line, correct?

Thanks again.
 
Wecome :)

Comments must be preceded by a semicolon, on the same line as the semicolon.
 
As I thought and it was. The code above wrapped it to the next line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top