Author Topic: ssget filters  (Read 3020 times)

0 Members and 1 Guest are viewing this topic.

daron

  • Guest
ssget filters
« 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:
Code: [Select]
(ssget (list '(-4 . "<NOT")
'(70 . 1)
'(-4 . "NOT>")
)
)
and
Code: [Select]
(ssget (list '(-4 . "<NOT")
                '(-4 . "<AND")
                '(0 . "LWPOLYLINE")
'(70 . 1)
                '(-4 . "AND>")
'(-4 . "NOT>")
)
)
Both ways I get closed plines. What am I missing?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ssget filters
« Reply #1 on: December 03, 2007, 12:01:45 PM »
Try this one.
Code: [Select]
(ssget '((0 . "LWPOLYLINE")(-4 . "<not")(-4 . "&")(70 . 1)(-4 . "NOT>")))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ssget filters
« Reply #2 on: December 03, 2007, 12:02:13 PM »
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.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

daron

  • Guest
Re: ssget filters
« Reply #3 on: December 03, 2007, 12:24:39 PM »
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:
Quote
1 = Closed; 128 = Plinegen
So, while this code:
Code: [Select]
(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:
Code: [Select]
(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.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: ssget filters
« Reply #4 on: December 03, 2007, 12:52:16 PM »
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.
Code: [Select]
(ssget (list '(-4 . "<NOT")
       '(-4 . "&")
       '(70 . 1)
       '(-4 . "NOT>")
  )
  )

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ssget filters
« Reply #5 on: December 03, 2007, 12:57:27 PM »
As Jeff points out, the example I posted does work with '(70 . 129)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: ssget filters
« Reply #6 on: December 03, 2007, 01:02:34 PM »
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:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ssget filters
« Reply #7 on: December 03, 2007, 01:04:53 PM »
I'm in stealth mode  8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ssget filters
« Reply #8 on: December 03, 2007, 01:17:45 PM »
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
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

daron

  • Guest
Re: ssget filters
« Reply #9 on: December 03, 2007, 03:09:21 PM »
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

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ssget filters
« Reply #10 on: December 03, 2007, 03:28:34 PM »
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
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: ssget filters
« Reply #11 on: December 03, 2007, 03:35:00 PM »
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:

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

daron

  • Guest
Re: ssget filters
« Reply #12 on: December 03, 2007, 04:33:57 PM »
Aha. That makes sense. Thanks Alan.