Special closed polyline filters?

Discussion in 'AutoCAD' started by Fatfreek, Dec 17, 2004.

  1. Fatfreek

    Fatfreek Guest

    I thought the following was good but it's not:
    (ssget "x"
    '((-4 . "&")
    (70 . 1)
    )
    )

    I'm trying to select only closed polys -- light or heavy. The old ellipses
    are okay (pellipse = 1) but only the None and Fit, not the Quadratic or
    Cubic.

    Can someone help with a proper set of filters?
    Len Miller
     
    Fatfreek, Dec 17, 2004
    #1
  2. Fatfreek

    Dann Guest

    (setq sset(ssget "x" '((0 . "*polyline")(70 . 1))))
     
    Dann, Dec 17, 2004
    #2
  3. Fatfreek

    Jeff Mishler Guest

    This seems to work:

    (ssget "x" '((0 . "*POLYLINE")(-4 . "<OR")(70 . 1)(70 . 3)(70 . 4)(70 .
    129)(70 . 131)(70 . 132)(-4 . "OR>")))
     
    Jeff Mishler, Dec 17, 2004
    #3
  4. Fatfreek

    BillZ Guest

    (SSGET "X" (LIST (CONS 8 "0")'(0 . "POLYLINE,LWPOLYLINE")'(-4 . "&")'(70 . 1)))

    I think Paul T. posted this once.

    Bill
     
    BillZ, Dec 17, 2004
    #4
  5. Fatfreek

    BillZ Guest

    forget the layer (if you want).

    (SSGET "X" (list '(0 . "POLYLINE,LWPOLYLINE")'(-4 . "&")'(70 . 1)))
     
    BillZ, Dec 17, 2004
    #5
  6. Fatfreek

    Tom Smith Guest

    (SSGET "X" (list '(0 . "POLYLINE,LWPOLYLINE")'(-4 . "&")'(70 . 1)))

    As long as we're on the filter-optimizing kick, I liked the wildcard usage

    (SSGET "X" '((0 . "*POLYLINE") (-4 . "&") (70 . 1)))
     
    Tom Smith, Dec 17, 2004
    #6
  7. Interesting, I'm just the opposite. I prefer to specify
    each entity type.
     
    Jason Piercey, Dec 17, 2004
    #7
  8. Fatfreek

    Tom Smith Guest

    Interesting, I'm just the opposite. I prefer to specify each entity type.

    Sometimes you see some clever tricks to abbreviate filter lists. I liked
    this one just because it reduced the verbosity in specifying both flavors of
    plines -- spelling them out wouldn't make it any more clear for me.

    Wildcards are frequently useful for me in filtering for block names, only
    because we use highly consistent naming conventions. When I do a trick like
    that, I'll add comments elaborating on my block name assumptions. So
    ultimately it doesn't reduce the total amount of text in the lisp, but it
    slims down the code itself.
     
    Tom Smith, Dec 17, 2004
    #8
  9. The only problem with the wildcards is if Autodesk
    introduces new entity types it may cause you some
    unwanted selection set filtering.

    You may need to go back and revise *all that code*
    to make them behave as they were intended. OTOH,
    you could also say the same for wanting the new types
    included in the selection set.

    6 one way, half a dozen the other.
     
    Jason Piercey, Dec 17, 2004
    #9
  10. Fatfreek

    Tom Smith Guest

    6 one way, half a dozen the other.

    I agree on both counts. If I'd been using '(0 . "*text*) to include mtext,
    God only knows what some of those those functions would have done with rtext
    when it appeared. Got any inside leads on new kinds of plines coming down
    the pike? :)
     
    Tom Smith, Dec 17, 2004
    #10
  11. Fatfreek

    Tom Smith Guest

    "*text" that is
     
    Tom Smith, Dec 17, 2004
    #11
  12. If I told you, I'd have to kill you ;)

    Seriously, I know nothing about any new polylines.
     
    Jason Piercey, Dec 17, 2004
    #12
  13. Fatfreek

    Fatfreek Guest

    It does, indeed. I created a test drawing with a variety of 16 entities
    including plain lines, arcs, circles, regions, heavy polys, and light polys.

    Your snippet caught all 9 correct ones. My notes said that okay codes are
    1, 129, 131. Not okay are 128, 133.

    How did you derive the 3, 4, 131 and 132?
    Most Grateful, Len

     
    Fatfreek, Dec 18, 2004
    #13
  14. Fatfreek

    Fatfreek Guest

    Your code fetched 2 heavy and 1 light polylines of possible 3 heavy and 6
    lights. I thought you'd like to know.

    Thanks, Len
     
    Fatfreek, Dec 18, 2004
    #14
  15. Fatfreek

    Fatfreek Guest

    Your code got 5 heavy and 6 light polys of possible 3 heavy and 6 lights. I
    suspect the 2 extra heavies were the quadratic and cubic ones.

    Thanks, Len.
     
    Fatfreek, Dec 18, 2004
    #15
  16. Fatfreek

    Jeff Mishler Guest

    Hi Len,
    To tell you the truth, now that I look at it again, I'm not sure how mine
    passed all the tests. 4 & 132 should not be included and I don't have a clue
    how those got in there..... ;-)
    However, 3 should be since you said Fit curves are OK. Fit = 2 + Closed = 1
    = 3, which also will include 131 (128 + 3).

    --
    Jeff
    check out www.cadvault.com
     
    Jeff Mishler, Dec 18, 2004
    #16
  17. Fatfreek

    Fatfreek Guest

    I looked further and found those bits, listed only under HEAVY polyline
    help.

    For those lurking:
    1 = This is a closed polyline (or a polygon mesh closed in the M direction)
    2 = Curve-fit vertices have been added
    4 = Spline-fit vertices have been added
    8 = This is a 3D polyline
    16 = This is a 3D polygon mesh
    32 = The polygon mesh is closed in the N direction
    64 = The polyline is a polyface mesh
    128 = The linetype pattern is generated continuously around the vertices of
    this polyline



    Therefore (my understanding) 1, 2, 3, 128, 129, 130, 131 - are okay.



    But -- when my code contains those numbers my accepted set is now up to 11
    instead of 9. The incorrect ones are open polys, one light and one heavy.



    I've gone back to your original suggested code, coming up with the right
    number I've, one by one rechecked the handles in the Vlide Watch Window,
    comparing with the handles at each entity that I've printed on the drawing
    next to each. Perfect.



    Go figger!

    Len



    ps: I will be happy to attach my drawing, some 53K, if asked.
     
    Fatfreek, Dec 18, 2004
    #17
  18. Fatfreek

    Fatfreek Guest

    I'd better clarify. Since my original post I've added two open polylines,
    one heavy and one light. However, the original number of 9 acceptable still
    applies.
     
    Fatfreek, Dec 18, 2004
    #18
  19. Fatfreek

    John Uhden Guest

    This gets open ones...
    (ssget "X"
    (list
    '(0 . "*POLYLINE")
    '(-4 . "<NOT")'(-4 . "&=")'(70 . 1)'(-4 . "NOT>")
    )
    )

    This should get closed ones...
    (ssget "X"
    (list
    '(0 . "*POLYLINE")
    '(-4 . "&=")'(70 . 1)
    )
    )
     
    John Uhden, Dec 20, 2004
    #19
  20. Fatfreek

    Fatfreek Guest

    It's not pretty (I don't know the streamlined stuff) but I tacked onto your
    second example some code to exclude the cubic and the quadratic polys -- and
    it finally works (at least for my test drawing), getting 9 qualified
    entities:
    (ssget "X"
    (list
    '(0 . "*POLYLINE")
    '(-4 . "&=")
    '(70 . 1)
    '(-4 . "<NOT")
    '(75 . 5)
    '(-4 . "NOT>")
    '(-4 . "<NOT")
    '(75 . 6)
    '(-4 . "NOT>")
    )
    )


     
    Fatfreek, Dec 20, 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.