TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: A_LOTA_NOTA on July 16, 2007, 08:47:27 PM
-
How could I compare entity names to make sure they are not equal? If I wanted to test to see if the were equal I could use (eq Ent1 Ent2) & get "T" but (/= Ent1 Ent2) I also get "T"!
-
Hi A_LOTA_NOTA ,
I think you want like this.
(defun c:test (/ ss1 ss2)
(setq ss1 (car (entsel "\nSelect an object first")))
(setq ss2 (car (entsel "\nSelect an object second")))
(if
(eq ss1 ss2)
(alert "\nThis object is same entity")
) ; if
(if
(not (eq ss1 ss2))
(alert "\nThis object is not same entity")
) ; if
(princ)
)
How could I compare entity names to make sure they are not equal? If I wanted to test to see if the were equal I could use (eq Ent1 Ent2) & get "T" but (/= Ent1 Ent2) I also get "T"!
-
Hi,
You have to use eq or equal function, = and /= only work with numbers or strings.
-
This should do it:
(if (eq (car (entsel)) (car (entsel)))
(alert "same")
(alert "not same")
)