Erase all Non-Selectable Objects

Discussion in 'AutoCAD' started by Andrew Lee, Apr 8, 2004.

  1. Andrew Lee

    Andrew Lee Guest

    Hi all,

    I am looking for a routine that will erase all non-selectable objects.

    Here is what i manualy do (all layers thawed/on/unlocked):

    Command: E
    ERASE
    Select objects: ALL
    9656 found

    Select objects: R

    Remove objects: Specify opposite corner: 9630 found, 9630 removed, 22 total

    Those 22 objects i cannot select, all I can see are their grips.
    I used the Quick Selection tool and have found them to be TEXT.

    Thanks
    Andrew L.

    A2K2
     
    Andrew Lee, Apr 8, 2004
    #1
  2. Andrew Lee

    Andrew Lee Guest

    I cannot select them with a window and they are not only text.
     
    Andrew Lee, Apr 9, 2004
    #2
  3. Andrew Lee

    Doug Broad Guest

    Andew,
    Try this. It may not get everything but it will eliminate most of
    the problem.

    (defun c:cleantxt ( / ss)
    ;;D. C. Broad, Jr. 4/8/2004
    (if
    (setq ss (ssget "x"
    (list (cons 0 "TEXT")
    (cons -4 "<or")
    (cons 1 "")
    (cons 1 " ")
    (cons 1 " ")
    (cons 1 " ")
    (cons 1 " ")
    (cons -4 "or>"))))
    (progn
    (command "erase" ss "")
    (princ (strcat "\n" (itoa (sslength ss)) " empty text entities were erased.")))
    (princ "\nNo empty text entities were found."))
    (princ)
    )

    I have the guts of this in my s:startup program without messaging so that
    all my drawings are constantly cleaned without my intervention.
     
    Doug Broad, Apr 9, 2004
    #3

  4. (ssget "x" '((0 . "TEXT") (1 . ",* *")))

    The wildcard pattern ",* *" matches an empty string
    or any string containing only spaces.



    AcadX for AutoCAD 2004 Beta 1
    http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip
     
    Tony Tanzillo, Apr 9, 2004
    #4
  5. On 4/9/2004 6:07 PM Tony Tanzillo wrote:
    maybe the "only" should be reconsidered, when there also are texts like
    "don't try this at home" in the drawing ;-)

    ruul
     
    ruul morawetz, Apr 9, 2004
    #5
  6. Tony,

    ",* *" appears to match any string empty or not.

    --
    Ken Alexander
    Acad2004
    Windows XP

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein
     
    Ken Alexander, Apr 9, 2004
    #6
  7. If we can assume valid text is considered to only that text that
    has at least one letter or number then perhaps ...

    (ssget "x"
    '( (0 . "text")
    (-4 . "<not")
    (1 . "*#*,*@*")
    (-4 . "not>")
    )
    )

    Otherwise you have to modifiy the match string to be a little
    more forgiving.

    For example, if the characters !,@ and # are also valid then

    (ssget "x"
    '( (0 . "text")
    (-4 . "<not")
    (1 . "*#*,*@*,*[!@#]*")
    (-4 . "not>")
    )
    )

    Cheers.
     
    michael puckett, Apr 9, 2004
    #7
  8. oops. You're right.

    More precisely,it matches any string that contains at
    least one space.

    The correct pattern is: ", "

    That works because a space in the pattern matches 0 or
    more spaces in the string.



    AcadX for AutoCAD 2004 Beta 1
    http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip
     
    Tony Tanzillo, Apr 9, 2004
    #8
  9. Nice. Now how is it that you know this and we don't? I don't
    see anything in the wcmatch or ssget help that would suggest
    this. That's a keeper.
     
    michael puckett, Apr 9, 2004
    #9
  10. Ackk, sorry for the full quote back.

    <snip>
     
    michael puckett, Apr 9, 2004
    #10
  11. Andrew Lee

    Gary J. Orr Guest

    Hey Tony,
    Wouldn't "* *" select any text string that included a space (such as "why
    me")?

    --
    Gary J. Orr
    CADD Administrator
    (218) 279-2421


    LHB, Inc
    21 West Superior Street, Suite 500
    Duluth, Mn 55802
    (218) 727-8446
    www.LHBcorp.com
     
    Gary J. Orr, Apr 9, 2004
    #11
  12. Tony Tanzillo, Apr 9, 2004
    #12
  13. Tony Tanzillo, Apr 9, 2004
    #13
  14. Thank you Tony.
     
    michael puckett, Apr 9, 2004
    #14
  15. I think there is another "undocumented" trick. But for the life of me
    I can't seem to find it. Someone showed me awhile back dealing with
    layer names.
    I'll make sure I remember this one. I would have liked to have known
    this when dealing with hitting the space bar for return on a getstring
    with T as an arg, then hitting return to kill it..

    Thanks Tony

    --
    Ken Alexander
    Acad2004
    Windows XP

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein
     
    Ken Alexander, Apr 9, 2004
    #15
  16. Andrew Lee

    John Uhden Guest

    I believe it was Steve Johnson (Aussie) who taught us in the old ACAD Forum.
     
    John Uhden, Apr 10, 2004
    #16
  17. Of nauseam fame?

     
    michael puckett, Apr 10, 2004
    #17
  18. Tony Tanzillo, Apr 10, 2004
    #18
  19. I use this to delete empty Mtext from exploded dimensions too:

    From: 06/04/2002 - Empty text, block and zero lenght line

    (ssget "_X" '((0 . "TEXT,MTEXT") (1 . " ,,\\A1; ,\\A1;,")))

    --
    ________________________________________________

    Marc'Antonio Alessi (TV) Italy
    (strcat "NOT a " (substr (ver) 8 4) " guru.")

    O.S. = XP Pro 2002 Ita - Sp.1
    AutoCAD = 2004 Ita - Sp.1a
    ________________________________________________
     
    Marc'Antonio Alessi, Apr 11, 2004
    #19
  20. Andrew Lee

    John Uhden Guest

    You can download KILLDOTS.LSP free from my Freebies page.
     
    John Uhden, Apr 11, 2004
    #20
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.