Jump to content

Recommended Posts

Posted

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

Posted

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)))'

Posted

@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.

Posted

 

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!

Posted
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:

image.thumb.png.bdbbacfb57d9a71443228a28ff9ffdee.png

 

"SSC" selects everything explicitly set to a COLOR override (not "Bylayer"):

image.thumb.png.4475a76faf833b66868a9aed74f34f9d.png

  

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.

 

Posted (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 by pkenewell
Posted

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.

Posted (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 by pkenewell
Posted

Sure, "SSCL" is already added to "Special_selections" lisp.

Thanks again.

  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...