Author Topic: "-4" code in SSGet Filter List  (Read 7988 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
"-4" code in SSGet Filter List
« on: May 07, 2009, 05:12:16 PM »
I know using such a code for logical conditionals such as:

(-4  .  "<OR")    (-4  .  "OR>")
(-4  .  "<AND")    (-4  .  "AND>")
(-4  .  "<XOR")    (-4  .  "XOR>")
(-4  .  "<NOT")    (-4  .  "NOT>")

etc etc


But recently, I have seen it used in the following way:

(0 . "CIRCLE")
(-4 . "*,=,*")
(assoc 10 dxf_ent)

where "dxf_ent" is the (entget) return for another Circle.

I was just wondering, what is the deal with this "-4" group code?  Is there somewhere a list of all the possibilities in which it can be used?

Your input and advice is much appreciated  8-)

Cheers

Lee    :lol:

T.Willey

  • Needs a day job
  • Posts: 5251
Re: "-4" code in SSGet Filter List
« Reply #1 on: May 07, 2009, 05:33:00 PM »
Look in the help for ' selection set filter lists '.  These are what they help is calling ' Relation tests '.  Here is a quick cut from the help.

Quote
Relational operators for selection set filter lists
 
Operator
 Description
 
"*"
 Anything goes (always true)
 
"="
 Equals
 
"!="
 Not equal to
 
"/="
 Not equal to
 
"<>"
 Not equal to
 
"<"
 Less than
 
"<="
 Less than or equal to
 
">"
 Greater than
 
">="
 Greater than or equal to
 
"&"
 Bitwise AND (integer groups only)
 
"&="
 Bitwise masked equals (integer groups only)
 
Tim

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

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: "-4" code in SSGet Filter List
« Reply #2 on: May 07, 2009, 05:34:38 PM »
Cheers Tim, I'll check that out  :-)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: "-4" code in SSGet Filter List
« Reply #3 on: May 07, 2009, 05:39:02 PM »
Cheers Tim, I'll check that out  :-)

You're welcome.
Tim

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

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: "-4" code in SSGet Filter List
« Reply #4 on: May 07, 2009, 11:06:28 PM »
An old thread:
http://www.theswamp.org/index.php?topic=1333.msg16766#msg16766

Here are some examples I have tucked away:
=======================================================================
CAB 03.29.08
get any nornal that is not 0 0 1
Code: [Select]
(setq ss (ssget "X" '((-4 . "<NOT")(210 0.0 0.0 1.0)(-4 . "NOT>")(-4 . "*,*,*")(210 0.0 0.0 1.0))))=======================================================================
 Example by CAB
 Find a circle with a given center point
 
If the center point of the circle & the start point of the plines are the same this will get them.
Code: [Select]
(setq mdn (ssget "x" (list '(0 . "circle") (append '(10) stp))) )
If you need some wiggle room try this: [ignoring the z]
Code: [Select]
(setq wiggle 0.05)
(setq mdn (ssget "x" (list '(0 . "circle")
                            '(-4 . ">,*,*") (list 10 (- (car stp) wiggle) 0 0)
                            '(-4 . "<,*,*") (list 10 (+ (car stp) wiggle) 0 0)
                            '(-4 . "*,>,*") (list 10 0 (- (cadr stp) wiggle) 0)
                            '(-4 . "*,<,*") (list 10 0 (+ (cadr stp) wiggle) 0)
                            ) )
)

Reads like this:
Code: [Select]
(if  (and  (> (center x) (- (pt x) wiggle))
(< (center x) (+ (pt x) wiggle))
(> (center y) (- (pt y) wiggle))
(< (center y) (+ (pt y) wiggle))
    )
============================================================
Example by Luis  uses a list of points

Code: [Select]
(setq filter (append (list '(-4 . "<AND") '(0 . "AECC_POINT") '(-4 . "<OR"))
                     (mapcar (function (lambda (x) (cons 90 x)))
                             num_list
                     )
                     (list '(-4 . "OR>") '(-4 . "AND>"))
             )
)
(ssget "X" filter)
============================================================
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.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: "-4" code in SSGet Filter List
« Reply #5 on: May 08, 2009, 05:41:08 AM »
Thanks CAB, some nice examples there  :-)