How do I change from Basis to lisp?

How do I change from Basis to lisp?

jinkinglee
Enthusiast Enthusiast
762 Views
2 Replies
Message 1 of 3

How do I change from Basis to lisp?

jinkinglee
Enthusiast
Enthusiast

IF SLOPE_LEFT < SLOPE_RIGHT THEN
    SLOPE = SLOPE_LEFT
ELSE
   SLOPE = SLOPE_RIGHT
END IF

0 Likes
Accepted solutions (1)
763 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant
Accepted solution

@jinkinglee wrote:

IF SLOPE_LEFT < SLOPE_RIGHT THEN
    SLOPE = SLOPE_LEFT
ELSE
   SLOPE = SLOPE_RIGHT
END IF


If SLOPE_LEFT and SLOPE_RIGHT are AutoLisp variables containing numbers [whether percentages of slope, or degrees or radians or something], you could do it with the same kind of "structure":

(if (< SLOPE_LEFT SLOPE_RIGHT)

  (setq SLOPE SLOPE_LEFT); then

  (setq SLOPE SLOPE_RIGHT); else

)

 

But it can be done more concisely:

(setq SLOPE (min SLOPE_LEFT SLOPE_RIGHT))

Kent Cooper, AIA
Message 3 of 3

john.uhden
Mentor
Mentor

Or more verbosely...

(setq slope (car (vl-sort '< (list slope_left slope_right))))

Of course the programmer must be aware of negative slopes due to what point was picked before the other.  He may want to consider comparing the absolute values.

John F. Uhden

0 Likes