Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

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

if statement problem:

170 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?

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

 

OOPS, forgot the = sign

Thanks
*Expert Elite*
dgorsman
Posts: 5,698
Registered: ‎10-12-2006
Message 2 of 4 (166 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 (162 Views)

Re: if statement problem:

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

Thanks
*Expert Elite*
Kent1Cooper
Posts: 5,879
Registered: ‎09-13-2004
Message 4 of 4 (152 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.