layers filter?

layers filter?

nivellhayani
Participant Participant
388 Views
3 Replies
Message 1 of 4

layers filter?

nivellhayani
Participant
Participant
Is there a way to define a selection so that when I select it, 
certain layers will be shown to me instead of turning them off each time
and then switching between selections For example- by selecting one layers 4 and 5 will be off,
but by selecting the other, layers 1, 2, 3, 6, 7 will be off.

 

0 Likes
389 Views
3 Replies
Replies (3)
Message 2 of 4

jskalaXDDX5
Advocate
Advocate

I am not sure if you can do that by selecting an object...but the Layer States Manager can do that in terms of turning layers on and off, locking, etc...one can make Macros with the CUI and assign to buttons, etc...

0 Likes
Message 3 of 4

pendean
Community Legend
Community Legend
There is nothing built-in that does that: are you just trying to save a step or two when isolating layers?
You'll need to customize with LISP if and only if you are running LT2024-LT2025 and someone wants to help you write up that code to use instead of any core commands and functions.
0 Likes
Message 4 of 4

vladimir_michl
Advisor
Advisor

Maybe something like:

 

 

(defun C:SELGRP ( / *doc* group grplist sel)

 (defun :LayerFilterList (/ :SubFilterList)

  ; returns list of main filter and sub filters (by BeekeeCZ)
  (defun :SubFilterList (dict / ent lst)
    (foreach ent (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 350)) dict))
      (setq lst (append lst
                        (cons ent (if (assoc 360 (entget ent))
                                    (:SubFilterList (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget ent)))))))))))))
    lst)

  (mapcar '(lambda (x) (cdr (assoc 300 (entget x))))
          (:SubFilterList (dictsearch
                            (vlax-vla-object->ename
                              (vla-getextensiondictionary
                                (vla-get-layers *doc*
                                  )))
                            "ACLYDICTIONARY")))
 )

 (setq *doc* (vla-get-activedocument (vlax-get-acad-object)))
 (vlax-for group (vla-get-groups *doc*)
  (setq grplist (cons (vla-get-name group) grplist))
 )
 (setq grplist (reverse grplist))
 (initget 1 (apply 'strcat (mapcar '(lambda(a) (strcat a " ")) grplist)))
 (setq sel (getkword (strcat "\nSelect group [" (apply 'strcat (mapcar '(lambda(a) (strcat a "/")) grplist)) "]: ")))
 (setvar "cmdecho" 0)
 (command "_SELECT" "_G" sel "")
 (if (member sel (:LayerFilterList))
  (command "_-LAYER" "_Filter" "_Set" sel "_X" "")
 )
 (setvar "cmdecho" 1)
 (sssetfirst nil (ssget "_P"))
 (princ)
)

 

 

Part of the GRP tool from CADforum.cz. Selects a selection group by name and switches to the layer filter of the same name (if available).

 

Vladimir Michl, www.arkance.world  -  www.cadforum.cz

 

0 Likes