Exclude objects from selection set
When I ran a search for the above title, the forum returned that all the words except "set" are too common, so I have no other choice but to post my question.
Situation:
I would like to run a spell check on all objects in the current space except for our map blocks.
Our map blocks are all called M# where the # is a number 1-24 presently.
I created a lisp routine that would run spell check and then plot the drawing, basically a way to force the use of spell check on our drawings. However on the cover page when spell check runs it selects all the objects and that includes the location maps, which have many street names that are not common words, thus taking a long time to check the spelling. spell check can be canceled and the drawing will still plot.
this is what I am currently using to run spell check:
Code:
(command "spell" "all" "")
Any help would be greatly appreciated.
RE: Exclude objects from selection set
I don't know of any way to "exclude" by filtering, but you can build a selection set containing everything, then remove the "excluded" ones
Code:
(setq sset (ssget "X") sset2 (ssget "X" '((0 . "INSERT")(2 . "M*"))) i 0)
(repeat (sslength sset2)
(ssdel (ssname sset2 i) sset)
(setq i (1+ i))
)
RE: Exclude objects from selection set
Quote:
Originally Posted by rkmcswain
I don't know of any way to "exclude" by filtering, but you can build a selection set containing everything, then remove the "excluded" ones
Code:
(setq sset (ssget "X") sset2 (ssget "X" '((0 . "INSERT")(2 . "M*"))) i 0)
(repeat (sslength sset2)
(ssdel (ssname sset2 i) sset)
(setq i (1+ i))
)
You could use the not association list to exclude items from a selection set.
Code:
(setq sset (ssget "X" '((-4 . "<NOT")(2 . "M*")(-4 . "NOT>")(0 . "INSERT"))))
RE: Exclude objects from selection set
This will select all but text objects.
Code:
(setq ss (ssget '((0 . "~TEXT"))))
I'm assuming you can do this for what you want, but I haven't tried it yet.
RE: Exclude objects from selection set
This is what I ended up using, it seems to work well enough for what I need
Code:
(setq sset (ssget "X") sset2 (ssget "X" '((0 . "INSERT")(2 . "M*"))) i 0)
(repeat (sslength sset2)
(ssdel (ssname sset2 i) sset)
(setq i (1+ i))
)
(command "SPELL" sset "")
thanks again.
RE: Exclude objects from selection set
Quote:
Originally Posted by Opie
You could use the not association list to exclude items from a selection set.
Code:
(setq sset (ssget "X" '((-4 . "<NOT")(2 . "M*")(-4 . "NOT>")(0 . "INSERT"))))
You are right, but your code has a flaw. It only selects INSERT objects that are not named "M*"
The following selects all drawing entities except INSERT's named "M*"
Code:
(ssget "X" '((-4 . "<NOT")(-4 . "<AND")(0 . "INSERT")(2 . "M*")(-4 . "AND>")(-4 . "NOT>")))
ccowgill, Opie is right, use (ssget), it should be faster. My first post was wrong.
Thanks for the reminder Opie.
RE: Exclude objects from selection set
Thanks, I switched out the code and it works great, no more plotting out drawings that have typo's, every time I plot, spell check now automatically runs and I can still cancel the spell check if I wish.
Thanks again,
RE: Exclude objects from selection set
As I was running spell check I noticed that it was checking spelling of frozen objects. How do I exclude objects that are frozen from the selection set
RE: Exclude objects from selection set
Quote:
Originally Posted by ccowgill
As I was running spell check I noticed that it was checking spelling of frozen objects. How do I exclude objects that are frozen from the selection set
Try this:
Code:
(ssget "all" '(
(-4 . "<NOT")
(-4 . "<AND")
(0 . "INSERT")
(2 . "M*")
(-4 . "AND>")
(-4 . "NOT>")
)
)
The "all" keyword is undocumented (as far as I can tell), but it works a little different than "x", in that it filters out frozen layers
Another option: http://tinyurl.com/npbjz