TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: daron on December 03, 2007, 11:46:01 AM
-
It's been a while since I messed with these so maybe this is just something little that I'm overlooking, but...
I'm trying to get a selection set and during the getting process NOT allow lwpolylines that are closed. I've tried this:
(ssget (list '(-4 . "<NOT")
'(70 . 1)
'(-4 . "NOT>")
)
)
and
(ssget (list '(-4 . "<NOT")
'(-4 . "<AND")
'(0 . "LWPOLYLINE")
'(70 . 1)
'(-4 . "AND>")
'(-4 . "NOT>")
)
)
Both ways I get closed plines. What am I missing?
-
Try this one.
(ssget '((0 . "LWPOLYLINE")(-4 . "<not")(-4 . "&")(70 . 1)(-4 . "NOT>")))
-
Both ways work here. Maybe the polyline are not really closed. They could have the same end point and start point, but not be closed. I think that is what is happening to you. I drew a rectangle and a three segment polyline, and only the three segment pline was selected.
-
Hmm. Tim, I found my problem and you're right, they both work. However, the objects are closed, but according to the help files the lwpolyline dxf flags are this:
1 = Closed; 128 = Plinegen
So, while this code:
(ssget (list '(-4 . "<NOT")
'(-4 . "<AND")
'(0 . "LWPOLYLINE")
'(70 . 1)
'(-4 . "AND>")
'(-4 . "NOT>")
)
)
will find and remove polylines that are closed, it will not find ones that have both flags set, so the code needs to be:
(ssget (list '(-4 . "<NOT")
'(-4 . "<or")
'(70 . 129)
'(70 . 1)
'(-4 . "or>")
'(-4 . "NOT>")
)
)
or something similiar.
Thanks for getting me to dig in a little deeper and for the help. Anyway, the code you posted looks like it will only find plines and as long as they are not closed. I want to allow selection of any object type except closed plines. No biggie though. It's figured out. Thanks again.
-
Daron,
There is a Bitwise operator that can be used in lieu of the OR's......doesn't make much difference code-wise in this case since there are only 2 variations to check for, but for future reference when trying to filter for something else (or, if they add more to the LWPLINE's 70 code) look at using the "&" bitwise operator.
(ssget (list '(-4 . "<NOT")
'(-4 . "&")
'(70 . 1)
'(-4 . "NOT>")
)
)
-
As Jeff points out, the example I posted does work with '(70 . 129)
-
As Jeff points out, the example I posted does work with '(70 . 129)
Heh, Now how did I not see your post CAB? Oh I see, you slipped in there between the 2 times I visited this thread. :oops:
-
I'm in stealth mode 8-)
-
You're welcome for what I did.
Thanks Jeff and Alan, as I learned something new because of what you guys did. Time to go home! :-D
-
Sorry. A little confusion. CAB, I read your code post as if T.Willey wrote it. Sorry to not give credit properly. T's comment "Maybe the polyline are not really closed." prompted me to dig a little deeper into the object I was inspecting. even though it was closed, it had the 128 bit set. As for the code, are you and Jeff saying that the & operator is an AND or OR? Also, maybe it's just me, but the html coder in me doesn't like to see code not closed out as would be the case with that bitwise operator. :-D
-
Yes it is a bitwise AND with no CLOSE used in that case.
Here is where I learned about it. :-)
http://www.theswamp.org/index.php?topic=4214.msg50368#msg50368
-
Yes it is a bitwise AND with no CLOSE used in that case.
Here is where I learned about it. :-)
http://www.theswamp.org/index.php?topic=4214.msg50368#msg50368
WOW :-o ... that thread has me a little bit embarrassed :oops:
-
Aha. That makes sense. Thanks Alan.