Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I just wanted to say that you guys RULE, a million thank you's to whoever created, and/or manages this site. KEEP UP THE GOOD WORK..."

Geography

Where in the world do Tek-Tips members come from?

Please someone explain an IF ELSE statement if LISP..Helpful Member! 

basepointdesignz (Programmer)
25 Oct 06 10:42
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

Helpful Member!  kpetursson (Programmer)
25 Oct 06 11:08
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

basepointdesignz (Programmer)
25 Oct 06 11:20
Perfectly explained, got my little routine to work as i wanted..

Thanks Kevin

     Cheers,
           Paul @ basepoint designz ltd..

basepointdesignzltd
www.bpdesignz.com

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!

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