TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Grrr1337 on February 18, 2017, 11:40:35 AM

Title: ssget LWPOLYLINE filtering
Post by: Grrr1337 on February 18, 2017, 11:40:35 AM
Hi guys,  :-) I got curious about this:
How to construct 3 different ssget filters for LWPOLYLINE that:
Title: Re: ssget LWPOLYLINE filtering
Post by: ribarm on February 18, 2017, 12:34:25 PM
- LWPOLYLINES without bulges - with straight segments :
(setq s (ssget (list '(0 . "LWPOLYLINE") '(-4 . "<not") '(-4 . "<>") '(42 . 0.0) '(-4 . "not>"))))
- LWPOLYLINES with bulges - without straight segments :
(setq s (ssget (list '(0 . "LWPOLYLINE") '(-4 . "<not") '(-4 . "=") '(42 . 0.0) '(-4 . "not>"))))
- LWPOLYLINES with some bulges and some straight segments :
(setq s (ssget (list '(0 . "LWPOLYLINE") '(-4 . "<and") '(-4 . "<or") '(-4 . "=") '(42 . 0.0) '(-4 . "or>") '(-4 . "<or") '(-4 . "<>") '(42 . 0.0) '(-4 . "or>") '(-4 . "and>"))))
Title: Re: ssget LWPOLYLINE filtering
Post by: gile on February 18, 2017, 12:46:41 PM
The last filter can be simplified (AND is implicit in a selection filter list):

Code - Auto/Visual Lisp: [Select]
  1. '((0 . "LWPOLYLINE") (-4 . "=") (42 . 0.0) (-4 . "<>") (42 . 0.0))
Title: Re: ssget LWPOLYLINE filtering
Post by: Grrr1337 on February 18, 2017, 01:22:25 PM
Thanks, Marko!
Now I see that the answer had to do with the "NOT" groupcode, as I've tried this at first (but got different results):
Code - Auto/Visual Lisp: [Select]
  1. (sssetfirst nil ; - LWPOLYLINES that have some straight segments :  
  2.   (ssget (list '(0 . "LWPOLYLINE") '(-4 . "=") '(42 . 0.0)))
  3. )
  4.  
  5. (sssetfirst nil ; - LWPOLYLINES that have some bulges :
  6.   (ssget (list '(0 . "LWPOLYLINE") '(-4 . "!=") '(42 . 0.0)))
  7. )
Title: Re: ssget LWPOLYLINE filtering
Post by: Stefan on February 18, 2017, 04:18:00 PM
Grrr, note that every vertex comes with a bulge, even the last one in open polylines. Usually, this last bulge is 0.0, so you cannot differentiate an open, full bulged polyline from a polyline which has some straight and some bulged segments.
Title: Re: ssget LWPOLYLINE filtering
Post by: Grrr1337 on February 19, 2017, 05:48:42 AM
Thanks Stefan,
I didn't notice that an open polyline have segment group codes for every vertex.