Select N Layers

Is there a way that will allow me to only select objects on the current layer?

Comments

  • Quote from BC Help:
    "Using Quick Select you can specify filters, such as entity type, color, linetype or any other entity property,  to compose a selection set."

  • Thank you Roy. I will try your sugestion. Most of the time I only need to perform an action on one item.

  • The LayIso command may also be helpfull.

  • Or you could use this command to create the selection set:

     

    ;;; --- QLL creates a selection set filtered for the currently active layer
    ;;; -----------------------------------------------------
    (defun c:QLL ()
    (princ " selects only entities on the active layer. ")
    (setq LAobj (vla-get-ActiveLayer (vla-get-activedocument (vlax-get-acad-object))))
    (setq LAname (vla-get-Name LAobj))
    (princ LAname)
    (setq PR (cons 8 LAname))
    (setq ss1 (ssget (list PR)))
    (if ss1 (command "selgrips" ss1 "")
    (progn (princ "\n ...none found.") (princ)) )
    (command "regen")
    (command "selgrips" "p" "")
    ) ;;; -----------------------------------------------------

     

     

  • What about simply locking all other layers?

    Command " Layer , lock, * "

    Then unlock the active.

    Propably a much simpler routine.

    Patrik

     

  • Thanks all for your replies. They are greatly appreciated.

    LayerIso is not always suitable as many times I need to see the entities on more than one layer.

    Anthony's command looks OK. However, I do not know how to operate the Lisp file.

    Pat's idea of locking all other layers by a command looks most promising. However, while I can do it the long way, I cannot get Command " Layer , lock, * " to work.

    It should be stated that I am a novice when it comes to Bricscad and know enough to be dangerous.

     

  • Sorry !

    Type layer then choose Lock from the menu then type *.

    Voila unfortunately all layers are locked so you have to unlock the current.

    the LISP would be something like this.

    (defun C:LLA () ;Layer Lock All
      (COMMAND ".LAYER" "lo" "*" "")
      (COMMAND ".LAYER" "u" "(getvar "clayer") "")

    Some of you other guys have to help me out here because there is something wrong with the (getvar "clayer") part.

    Im definately useless at LISP this is actually my first one and it doesn even WORK !  ;-)

    But I think Im close.

    Cheers

    Patrik

     

     

  • There's a toolbar "Layers". If you haven't it displayed already, rightklick
    on a toolbar and select "BRICSCAD" and "Layers" from the menu now showing. There you can
    lock/unlock, freeze/thaw, on/off and isol/unisol layers by simply clicking on an item.

    @ Patrick : One quote to much in front of "(getvar "clayer") -> (getvar "clayer")

  • To use any lisp command, just copy and paste the code into the end of your "On_start.lsp" file and save it. That's all.

    Then it will load automatically each time you open a drawing, and you'll be able to use it by typing the command name, which is whatever comes immediately after "defun c:" in the code.

    To find the "On_start.lsp" file:
    Pull down Settings > Settings > Program options > Files > Support File Search path
    The first folder listed there, the one with a long path, is your user support folder. Open that folder and you'll find the "On_start.lsp" file (if there isn't one, right-click and select New > Text document, and then rename the file that it creates, changing it from "New Text Document.txt" to "On_start.lsp").

  • Jörg

    Isnt it actually one quote to little?  Shouldnt there be one bothe before and after?  I cant make it work with or without quotes, there is some more problem. Have tried commanline typing the clayer with no result. I even set a variable to clayer and tried to call the variable wich didnt work either.

    Walter , Jörg is right. but if you want to lock all layers at once typing may be quicker.

    Patrik

  • Patrick: leave out the quotes, but add a close parenthesis at the end, to close the Defun

  • Anthony , unfortunately that doesnt work either, with or without quotes.

    BUT Walter this does !  Paste this in "On_start.lsp" Like Anthony said.

    (defun C:LLA () ;Layer Lock All
      (SETQ BABA (getvar "clayer"))
      (COMMAND ".LAYER" "lo" "*" "")
      (COMMAND ".LAYER" "u" baba ""))

    (Defun C:LUA ();Layer Unlock All
       (COMMAND ".LAYER" "u" "*" "")

    To lock all layers type LLA or add the function to a key. To Unlock Type lua.

    Patrik

     

This discussion has been closed.