Visual LISP, AutoLISP and General Customization

Reply
Active Member
delliston
Posts: 10
Registered: ‎10-31-2011
Message 1 of 4 (123 Views)
Accepted Solution

if statement problem:

123 Views, 3 Replies
01-02-2014 01:51 PM

OK, I thought I could use the "if" statement to say the following: (if userdimscale 15.0 (setvar dimscale 6.0)), in english, if userdimscale equals 15.0 then set dimscale to 6.0. so, what's wrong with that it doesn't work?

*Expert Elite*
dgorsman
Posts: 4,710
Registered: ‎10-12-2006
Message 2 of 4 (119 Views)

Re: if statement problem:

01-02-2014 01:59 PM in reply to: delliston

I'm not seeing a comparison operation in there...

 

(if ...) takes one comparison expression, one "if true" expression, and one "if false" expression:

 

(if (= 15.0 some_number)
   (foo_true)
   (foo_false)
)

 

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
Adopt. Adapt. Overcome. Or be overcome.
A good question will be halfway to a good answer.


Active Member
delliston
Posts: 10
Registered: ‎10-31-2011
Message 3 of 4 (115 Views)

Re: if statement problem:

01-02-2014 02:04 PM in reply to: dgorsman
OOPS, forgot the = sign

Thanks
*Expert Elite*
Kent1Cooper
Posts: 4,967
Registered: ‎09-13-2004
Message 4 of 4 (105 Views)

Re: if statement problem:

01-02-2014 02:33 PM in reply to: delliston

delliston wrote:
OOPS, forgot the = sign

... as well as the parentheses enclosing the (=) function, and either an apostrophe ' preceding, or two double-quotes " surrounding, the System Variable name.  [I assume you also got those corrected, but just for the sake of anyone else looking around....]

 

(if (= userdimscale 15.0) (setvar 'dimscale 6.0))

Kent Cooper

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community