Search the Community
Showing results for tags 'if function'.
-
Checking Rectangle height with if Statement not working
Brok posted a topic in AutoLISP, Visual LISP & DCL
Hi, I want to check for the width and height of a Rectangle. I got this code (defun getRect () (if (setq rec (ssget "_X" (list '(0 . "LWPOLYLINE") '(8 . "LAYOUT") '(90 . 4) (cons 410 (getvar "ctab")) ))) (progn (setq e (ssname rec 0)) (setq coords (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget e)))) (setq height (distance (car coords) (nth 3 coords))) (setq width (distance (car coords) (nth 1 coords))) (if (= height 594.0) T (princ height) ) ) ) (princ) ) If I check for the Width it works and it returns T But If I try to get the height it returns false and prints 594.0 Why does this not return True as well?- 9 replies
-
- if function
- rectangle
-
(and 1 more)
Tagged with:
-
Request a variable and set a new variable with If function
Manuel_Kunde posted a topic in AutoLISP, Visual LISP & DCL
Hi, I'm trying to query the variable "Weight" and if it has the content "50" I want to define a new variable: "Stamp" with the content "internal". Is WCMATCH the right command for this? (if (= wcmatch Weight "50") (progn (setq stamp "intern"))) (princ) -
(defun gp:getPointInput (/ StartPt EndPt HalfWidth) (if (setq StartPt (getpoint "\nStart point of path: ")) (if (setq EndPt (getpoint StartPt "\nEndpoint of path: ")) (if (setq HalfWidth (getdist EndPt "\nhalf-width of path: ")) T ) ) ) ) I thought the syntax for the if function was: (if (test expression) (expression) (optional expression) ) What is the purpose of using 'if' in the above code?