×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

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

Please someone explain an IF ELSE statement if LISP..

Please someone explain an IF ELSE statement if LISP..

Please someone explain an IF ELSE statement if LISP..

(OP)
Hi,

Could someone please explain a typical IF ELSE statement in AutoLISP..

I've checked the help and it suggest the PROGN fucntion and i can't quite get my head round it, lol. Excuse me if i'm being hella-stupid..

Basically, i want to create a simple command line based routine that allows me to switch point styles. I want to just type something like PP, and it switches point style between the small dot (0 in PDMODE) and the crossed circle (35 in PDMODE)..
So if the point style is 35, then switch it to 1, and vice versa..

     Cheers,
           Paul @ basepoint designz ltd..

basepointdesignzltd
www.bpdesignz.com

RE: Please someone explain an IF ELSE statement if LISP..

The reason the help files suggest the PROGN function is as follows...

Basic If statement

CODE

(IF (single statement that will return TRUE or FALSE)
    (single statement that will be evaluated if above is TRUE)
    (single statement that will be evaluated if above is FALSE)
);end of IF

The statements evaluated by the IF statment are single statemnts only.  If you require more complex locig to be evaluated you need to have it look like...

CODE

(IF (single statement that will return TRUE or FALSE)
    (PROGN
       (statements that)
       (will be evaluated)
       (if above is TRUE)
    )
    (PROGN
       (statements that will)
       (be evaluated if above is FALSE)
    )
);end of IF

The PROGN function is used to make the LISP compiler behave as if everything with in the (PROGN .....) is a single statement.

I hope this is clear.

Kevin Petursson

RE: Please someone explain an IF ELSE statement if LISP..

(OP)
Perfectly explained, got my little routine to work as i wanted..

Thanks Kevin

     Cheers,
           Paul @ basepoint designz ltd..

basepointdesignzltd
www.bpdesignz.com

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