Author Topic: ssget one layer, two different colors  (Read 2435 times)

0 Members and 1 Guest are viewing this topic.

cadman6735

  • Guest
ssget one layer, two different colors
« on: September 11, 2014, 12:22:56 PM »
LISP drives me crazy...

Code: [Select]
(defun c:test ( / )

  (setq ss (ssget "_x" (list (cons 8 "TESTLAYER") (cons -4 "<AND") (cons 62 4) (cons 62 6) (cons -4 "AND>"))))

  (sssetfirst nil ss)

(princ)
)

I have put that ("<AND")("AND>") all over the map on this, I can't get it to work...

Can someone set me straight, Please

Thanks

ronjonp

  • Needs a day job
  • Posts: 7527
Re: ssget one layer, two different colors
« Reply #1 on: September 11, 2014, 12:27:14 PM »
Use OR
Code - Auto/Visual Lisp: [Select]
  1. (setq ss (ssget "_x" '((8 . "TESTLAYER") (-4 . "<OR") (62 . 4) (62 . 6) (-4 . "OR>"))))

Your code is looking for items that have two different colors which cannot happen.
« Last Edit: September 11, 2014, 12:35:51 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: ssget one layer, two different colors
« Reply #2 on: September 11, 2014, 12:33:49 PM »
Right.  As the original post stands, its trying for entities with (62 . 4) AND (62 . 6), which are mutually exclusive.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

cadman6735

  • Guest
Re: ssget one layer, two different colors
« Reply #3 on: September 11, 2014, 12:46:40 PM »
see LISP drives me crazy,

the logic is wrong in my head, OR to me would be one "or" the other, (not both)

AND would indicate color 1 "and" color 2 (both together)

Anyway, RonJon, your ninja skill have helped me once again, thank you very much...

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ssget one layer, two different colors
« Reply #4 on: September 11, 2014, 01:18:02 PM »
Just the way you phrase it.
I want apples AND they can be green OR red.

With ssget the AND is not needed most of the time as it is implied. :)
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.

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: ssget one layer, two different colors
« Reply #5 on: September 11, 2014, 01:22:00 PM »
I want apples AND they can be green OR red.

Don't eat to many green ones though......

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: ssget one layer, two different colors
« Reply #6 on: September 11, 2014, 01:36:53 PM »
see LISP drives me crazy,

the logic is wrong in my head, OR to me would be one "or" the other, (not both)

AND would indicate color 1 "and" color 2 (both together)

Anyway, RonJon, your ninja skill have helped me once again, thank you very much...

Standard Boolean logic.  An entity has only one color property - it can be RED or GREEN.  I cannot be RED and GREEN.  Apply the logic to the entities, not the filter settings.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

RGUS

  • Newt
  • Posts: 106
Re: ssget one layer, two different colors
« Reply #7 on: September 11, 2014, 02:28:45 PM »
Use OR
Code - Auto/Visual Lisp: [Select]
  1. (setq ss (ssget "_x" '((8 . "TESTLAYER") (-4 . "<OR") (62 . 4) (62 . 6) (-4 . "OR>"))))

Your code is looking for items that have two different colors which cannot happen.

With the 'Sum over histories' and quantum mechanics it might. Just kidding... good solution here.

cadman6735

  • Guest
Re: ssget one layer, two different colors
« Reply #8 on: September 11, 2014, 02:52:51 PM »
Thanks again guys, this site is one of the best for friendly and fast help.


« Last Edit: September 11, 2014, 02:55:55 PM by cadman6735 »

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: ssget one layer, two different colors
« Reply #9 on: September 13, 2014, 09:11:23 AM »
the logic is wrong in my head, OR to me would be one "or" the other, (not both)

You're thinking of XOR (eXclusive OR)  :wink: