See the top rated post in this thread. Click here

Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: Exclude objects from selection set

  1. #1
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default 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.

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Default 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))
    )
    R.K. McSwain | CAD Panacea |

  3. #3
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default 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"))))
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  4. #4
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default 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.

  5. #5
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default 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.

  6. #6
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Default 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.
    R.K. McSwain | CAD Panacea |

  7. #7
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: Exclude objects from selection set

    Quote Originally Posted by rkmcswain
    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.
    I realized that after I logged off. The code I posted was the example I was working with on my machine. I wasn't even working with the OP's request for the spell checker.

    Thanks for clarifing it for me.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  8. #8
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default 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,

  9. #9
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default 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

  10. #10
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Default 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
    R.K. McSwain | CAD Panacea |

Page 1 of 3 123 LastLast

Similar Threads

  1. freeze all objects in a selection set
    By james.randjelovic355350 in forum AutoLISP
    Replies: 6
    Last Post: 2013-02-11, 03:21 PM
  2. Add Objects to existing Selection Sets
    By payre in forum NavisWorks - General
    Replies: 2
    Last Post: 2009-04-06, 06:05 AM
  3. Remove objects from selection set
    By kkacadman in forum AutoCAD Civil 3D - General
    Replies: 10
    Last Post: 2007-04-12, 09:31 PM
  4. AutoCAD 2007 - Exclude objects form light
    By kubasch in forum AutoCAD 3D (2007 and above)
    Replies: 1
    Last Post: 2007-03-11, 11:38 PM
  5. Objects selection by X direction (-->)
    By avinash00002002 in forum VBA/COM Interop
    Replies: 1
    Last Post: 2006-09-29, 01:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •