pttr Posted March 30, 2023 Posted March 30, 2023 Hi I have this code, that checks every layer that starts with the name A- (if (setq ssL (ssget "_X" (list (cons 8 "A-*") '(410 . "Model")))) ;do something ) This works fine, but I want to make some exceptions in the selection of layers. EX: Select ( A-*) except (A-4) except (A-5) There are a lot of layers starting with A- (as you can imagine) and i only want to skip a few. Looked att Lee Macs code here: http://www.lee-mac.com/ssget.html#:~:text=Logical Not,256 (ByLayer). And it's something like this I´m looking for, but I can't make it work for the list selection. Quote
mhupp Posted March 30, 2023 Posted March 30, 2023 (edited) Don't know what your where trying but this should work. (if (setq ssL (ssget "_X" '((8 . "A-*")(-4 . "<NOT")(8 . "A-4,A-5")(-4 . "NOT>")(410 . "Model")))) ;Do stuff ) -Edit for each layer you want to ignore just add it into the middle (8 . "layer1,layer2,layer3,layer4,layer5") Also worth a look. (if (setq ssL (ssget "_X" '((8 . "A-*")(-4 . "<NOT")(8 . "A-#")(-4 . "NOT>")(410 . "Model")))) This would ignore layers A-0, A-1, A-2, A-3, A-4, A-5, A-6, A-7, A-8, & A-9 Edited March 30, 2023 by mhupp 1 Quote
pttr Posted March 30, 2023 Author Posted March 30, 2023 4 hours ago, mhupp said: Don't know what your where trying but this should work. (if (setq ssL (ssget "_X" '((8 . "A-*")(-4 . "<NOT")(8 . "A-4,A-5")(-4 . "NOT>")(410 . "Model")))) ;Do stuff ) -Edit for each layer you want to ignore just add it into the middle (8 . "layer1,layer2,layer3,layer4,layer5") Also worth a look. (if (setq ssL (ssget "_X" '((8 . "A-*")(-4 . "<NOT")(8 . "A-#")(-4 . "NOT>")(410 . "Model")))) This would ignore layers A-0, A-1, A-2, A-3, A-4, A-5, A-6, A-7, A-8, & A-9 I forgot to say that i need ssL to be a list, else I need to change a lot of stuff Quote
ronjonp Posted March 30, 2023 Posted March 30, 2023 3 hours ago, pttr said: I forgot to say that i need ssL to be a list, else I need to change a lot of stuff (setq l '("A-4" "A-5")) (setq ssl (ssget "_X" (list '(8 . "A-*") '(-4 . "<NOT") (cons 8 (apply 'strcat (mapcar '(lambda (x) (strcat x ",")) l))) '(-4 . "NOT>") '(410 . "Model") ) ) ) 3 Quote
pttr Posted March 31, 2023 Author Posted March 31, 2023 14 hours ago, ronjonp said: (setq l '("A-4" "A-5")) (setq ssl (ssget "_X" (list '(8 . "A-*") '(-4 . "<NOT") (cons 8 (apply 'strcat (mapcar '(lambda (x) (strcat x ",")) l))) '(-4 . "NOT>") '(410 . "Model") ) ) ) Woaw that is just great, thanks alot! Quote
ronjonp Posted March 31, 2023 Posted March 31, 2023 8 hours ago, pttr said: Woaw that is just great, thanks alot! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.