×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Error with if-then lisp

Error with if-then lisp

Error with if-then lisp

(OP)
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?
Replies continue below

Recommended for you

RE: Error with if-then lisp

(OP)
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

RE: Error with if-then lisp

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

RE: Error with if-then lisp

(OP)
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.  

RE: Error with if-then lisp

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?


RE: Error with if-then lisp

(OP)
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.

RE: Error with if-then lisp

Wecome :)

Comments must be preceded by a semicolon, on the same line as the semicolon.

RE: Error with if-then lisp

(OP)
As I thought and it was.  The code above wrapped it to the next line.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close