Did you try an OR filter ?
=DavidCode:(setq Tchg (ssget '((-4 . "<OR")(0 . "MTEXT")(0 . "TEXT")))

Registered forum members do not see this ad.
I definitely will, thanks Mircea, it appears SSGET is more complex than it appears at first glance![]()
Did you try an OR filter ?
=DavidCode:(setq Tchg (ssget '((-4 . "<OR")(0 . "MTEXT")(0 . "TEXT")))
R12 (Dos) - A2K
I also noticed that. The "<AND" would only select entities which are both MTEXT and TEXT ... which is kind-of impossible ... so nothing would be selected. But as others have shown you the wild-card matching actually gives a simpler approach in this case. To see other wild-card matches, read the help on the wcmatch function.
Anyhow, you don't need the "<AND" ... "AND>" grouping in most cases (other than this one) - it's already implied as such. It's only necessary when you have one or more OR's and portions thereof you want to have as AND's.
Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!
What ab. "<XOR"..."XOR>". I really have difficulties understanding XOR... Can someone explain with some example?...
M.R.
http://cplus.about.com/od/glossar1/g/xor.htm
Basically XOR returns T if 1 and only 1 test of 2 operands returns T
R12 (Dos) - A2K
The AND test is normally used for 2 unique DXF group values,
You can also group AND filters within OR testsCode:(-4 ". <AND") (0 . "CIRCLE) (40 . 1.0) (-4 . "AND>")
All of the logical filters (AND,OR,XOR,NOT) must be in balanced pairs
Wildcards can get to be confusing when you start trying to combine "~" with "*" and "," sequences.
Last edited by David Bethel; 29th Mar 2012 at 07:24 pm.
R12 (Dos) - A2K
The usual difficulty when working with and/or/xor is that most people (or rather most languages including English) doesn't define those words exactly as logical comparison defines them. Usually when people say "OR" what they mean is XOR (or Exclusive Or) - i.e. it's either the one or the other - not both. Logic Comp defines OR as "Any of the operands - even just one, but also more than one".
Then you get to the AND ... which also sometimes gets confusing. Since people sometimes misuse the word in conversation - you end up with situations like these. In Logic Comp AND means "All the operands - not just some".
The way lisp (and most other programming languages) work on these is the following:
AND:
OR:
- Check if next operand returns True (or not nil in the case of Lisp).
- If the test is positive, continue. Else return False/Nil.
- If there's any more operands repeat from 1, else return True.
NOT: Basically an invert toggle. If the operand (only one - doesn't work on more) is False/Nil return True. If the operand is True/NotNil return False/Nil.
- Check if next operand returns True (or not nil in the case of Lisp).
- If the test is positive, return True. Else continue.
- If there's any more operands, repeat from 1. Else return False/Nil.
XOR: This is how most people understand the word OR when spoken - i.e. as in "Either OR".
Though Lisp doesn't have a XOR function, you can make one quite easily. The principle behind it would be to combine OR, NOT & AND. E.g.:Thus it returns an AND of an OR & (NOT) AND. I.e. True only if OR returns true, but AND returns FALSE - otherwise return False/Nil.Code:(defun XOR (v1 v2 /) (and (or v1 v2) (not (and v1 v2))) )
Most other languages have built-in XOR functions/operators, but usually they'd be implemented similarly - just already done for you.
Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!
Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!
Registered forum members do not see this ad.
Three more variations of a possible XOR function, for fun:
Nice explanation IrneCode:(defun XOR ( a b ) (or (and a (not b)) (and b (not a))) ) (defun XOR ( a b ) (and (or (not a) (not b)) (or a b)) ) (defun XOR ( a b ) (or (not (or (not a) b)) (not (or a (not b)))) )![]()
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper
Bookmarks