thekiki Posted Wednesday at 02:21 PM Posted Wednesday at 02:21 PM Hi, "Special_selection" of Gilles is very useful. Typing "ssc" for color selecting. But when i select the color of layer, the others layers are selected. That's not what i want to have. Autocad file and "special_selection" lisp are attach for better explanation. Thanks for your help. Test-selection.dwg Special_selections.lsp Quote
GLAVCVS Posted Wednesday at 03:00 PM Posted Wednesday at 03:00 PM You forgot to set the layer filter for 'ssget' Replace '(sssetfirst nil (ssget "_X" (list col)))' with '(sssetfirst nil (ssget "_X" (list (assoc 8 elst) col)))' Quote
pkenewell Posted Wednesday at 03:01 PM Posted Wednesday at 03:01 PM @thekiki That is because if the Entity you select is set to "Bylayer" (meaning the color is controlled by the Layer), the routine will select everything else that is also "bylayer." use the "SSL" command instead to select everything on a layer. Quote
thekiki Posted Wednesday at 03:49 PM Author Posted Wednesday at 03:49 PM Pkenewell, in my case, if i use "ssl", all the entity by layer ( a lot of layers) are selected and that's not what i want. That's perfect GLAVCVS! Thanks a lot! Quote
pkenewell Posted Wednesday at 04:48 PM Posted Wednesday at 04:48 PM 47 minutes ago, thekiki said: Pkenewell, in my case, if i use "ssl", all the entity by layer ( a lot of layers) are selected and that's not what i want. That's perfect GLAVCVS! Thanks a lot! @thekiki I don't completely understand maybe, but it seems to work for me. "SSL" selects everything on "Layer1" regardless of color: "SSC" selects everything explicitly set to a COLOR override (not "Bylayer"): If you mean that you want to select everything that is "Red", whether it is actually Bylayer or not. Than you need something a little more complex; that iterates though the layers and finds the layer that matches the color. Then select all on that layer, EXCEPT anything explicitly color overridden to something other than "Red", then get everything else with the "Red" color override. Quote
pkenewell Posted Wednesday at 06:40 PM Posted Wednesday at 06:40 PM (edited) @thekiki Try this. It gets everything that is a specific color, regardless of whether it is explicitly set or is colored by the layer. Thanks to Gilles for inspiring the code structure. Tested and works in your drawing. (defun c:sscl (/ col elst ent lcol lel ss) (and (or (and (setq ss (cadr (ssgetfirst))) (= 1 (sslength ss)) (setq ent (ssname ss 0)) ) (and (sssetfirst nil nil) (setq ent (car (entsel "\nSelect Object: "))) ) ) (setq elst (entget ent) lel (tblsearch "LAYER" (cdr (assoc 8 elst))) col (cond ((assoc 430 elst)) ((assoc 420 elst)) ((assoc 62 elst)) (T (cons 62 256)) ) lcol (cond ((assoc 430 lel)) ((assoc 420 lel)) ((assoc 62 lel)) (T (cons 62 256)) ) ) (if (= (cdr col) 256) (sssetfirst nil (ssget "_X" (list '(-4 . "<OR") lcol '(-4 . "<AND") (assoc 8 elst) '( 62 . 256) '(-4 . "AND>") '(-4 . "OR>") ) ) ) (sssetfirst nil (ssget "_X" (list col))) ) ) (princ) ) Edited Wednesday at 06:47 PM by pkenewell Quote
thekiki Posted Thursday at 07:48 AM Author Posted Thursday at 07:48 AM Pkenewell, thanks for your answer. What i want that when I select entity (by layer) by layer1, only entity by layer1 is selected, whereas "ssl" select every thing on layer1. The modification of "GLAVCVS" is perfect. Thanks again for your reply. Quote
pkenewell Posted Thursday at 02:41 PM Posted Thursday at 02:41 PM (edited) 6 hours ago, thekiki said: Pkenewell, thanks for your answer. What i want that when I select entity (by layer) by layer1, only entity by layer1 is selected, whereas "ssl" select every thing on layer1. The modification of "GLAVCVS" is perfect. Thanks again for your reply. @thekiki OK. seems i misunderstood what you wanted in your original post. I'm glad that @GLAVCVS gave you what you needed. FWIW - I recommend adding the "SSCL" command I created to the "special Selections,lsp", it might come in handy to you in the future. I'm definitely adding it to my arsenal. Edited Thursday at 02:41 PM by pkenewell Quote
thekiki Posted Thursday at 04:36 PM Author Posted Thursday at 04:36 PM Sure, "SSCL" is already added to "Special_selections" lisp. Thanks again. 1 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.