TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: rude dog on September 20, 2004, 06:24:21 AM

Title: Check names
Post by: rude dog on September 20, 2004, 06:24:21 AM
How could one run a test on two entities selected to see if they have the same entity name...in autolisp...any ideas?
Title: Check names
Post by: Mark on September 20, 2004, 06:52:29 AM
Use 'eq' to test if entities are the same.

Code: [Select]

(setq e1 (car (entsel)))
<Entity name: 7ef61e10>
(setq e2 (car (entsel)))
<Entity name: 7ef61e10>
(eq e1 e2)
T
Title: Check names
Post by: rude dog on September 20, 2004, 06:55:44 AM
wow...duh...I need sleep..thanks
Title: Check names
Post by: SMadsen on September 20, 2004, 07:52:01 AM
Rude dog, I wouldn't know if you need sleep but not necessarily for having asked this question. It's a very good question which can cause quite a few errors when one doesn't bother to ask it.

Equality doesn't always equate equality when it comes to programming.
Title: Check names
Post by: CAB on September 20, 2004, 10:53:10 AM
Yes, don't use =

Code: [Select]
(setq e1 (car (entsel)))
<Entity name: 7ef61e10>
(setq e2 (car (entsel)))
<Entity name: 7ef61e10>
(eq e1 e2)
T
(= e1 e2)
nil
Title: Check names
Post by: CAB on September 20, 2004, 10:56:23 AM
In fact take a look here.
http://theswamp.org/phpBB2/viewtopic.php?t=764&highlight=equal+entity
Title: Check names
Post by: rude dog on September 20, 2004, 09:32:56 PM
Hey bro's....You know just to be honest  :oops:  :oops:
I did think that <=> and <eq> where the same..glad I asked
I guess I need to read.... more than I need the sleep...
Thanks 8)
Title: Check names
Post by: Keith™ on September 20, 2004, 11:56:52 PM
Actually you have:
[=]
[eq]
[equal]

All have distinct differences
Title: Check names
Post by: MP on September 21, 2004, 12:11:14 AM
Quote from: Keith
All have distinct differences

In other words, they are not equal.
Title: Check names
Post by: Keith™ on September 21, 2004, 12:16:33 AM
Not Equal in some other programming languages...

!=
<>
ne
Title: Check names
Post by: sinc on September 21, 2004, 11:29:26 AM
Not Equal = Sweet & Low?   :)
Title: Check names
Post by: Keith™ on September 21, 2004, 11:43:17 AM
Quote from: sinc
Not Equal = Sweet & Low?   :)

and sugar
Title: Check names
Post by: rude dog on September 25, 2004, 12:26:11 AM
Cant forget bout Splenda