Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
ssget LWPOLYLINE filtering
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: ssget LWPOLYLINE filtering (Read 1476 times)
0 Members and 1 Guest are viewing this topic.
Grrr1337
Swamp Rat
Posts: 812
WWW
ssget LWPOLYLINE filtering
«
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:
The first allows only LWpolylines that
all
of their segments are bulges
The second allows only LWpolylines that
some
of their segments are bulges
The third allows only LWpolylines that
all
of their segments are
straight
Logged
(apply ''((a b c)(a b c))
'(
(( f L ) (apply 'strcat (f L)))
(( L ) (if L (cons (chr (car L)) (f (cdr L)))))
(72 101 108 108 111 32 87 111 114 108 100)
)
)
vevo.bg
ribarm
Gator
Posts: 3298
Marko Ribar, architect
WWW
Re: ssget LWPOLYLINE filtering
«
Reply #1 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>"))))
Logged
Marko Ribar, d.i.a.
(graduated engineer of architecture)
M.R. on Youtube
gile
Gator
Posts: 2520
Marseille, France
WWW
Re: ssget LWPOLYLINE filtering
«
Reply #2 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]
'
(
(
0
.
"LWPOLYLINE"
)
(
-
4
.
"="
)
(
42
.
0.0
)
(
-
4
.
"<>"
)
(
42
.
0.0
)
)
Logged
Speaking English as a French Frog
Grrr1337
Swamp Rat
Posts: 812
WWW
Re: ssget LWPOLYLINE filtering
«
Reply #3 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]
(
sssetfirst
nil
; - LWPOLYLINES that have some straight segments :
(
ssget
(
list
'
(
0
.
"LWPOLYLINE"
)
'
(
-
4
.
"="
)
'
(
42
.
0.0
)
)
)
)
(
sssetfirst
nil
; - LWPOLYLINES that have some bulges :
(
ssget
(
list
'
(
0
.
"LWPOLYLINE"
)
'
(
-
4
.
"!="
)
'
(
42
.
0.0
)
)
)
)
Logged
(apply ''((a b c)(a b c))
'(
(( f L ) (apply 'strcat (f L)))
(( L ) (if L (cons (chr (car L)) (f (cdr L)))))
(72 101 108 108 111 32 87 111 114 108 100)
)
)
vevo.bg
Stefan
Bull Frog
Posts: 319
The most I miss IRL is the Undo button
Re: ssget LWPOLYLINE filtering
«
Reply #4 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.
Logged
Grrr1337
Swamp Rat
Posts: 812
WWW
Re: ssget LWPOLYLINE filtering
«
Reply #5 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.
Logged
(apply ''((a b c)(a b c))
'(
(( f L ) (apply 'strcat (f L)))
(( L ) (if L (cons (chr (car L)) (f (cdr L)))))
(72 101 108 108 111 32 87 111 114 108 100)
)
)
vevo.bg
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
ssget LWPOLYLINE filtering