Turn selected layer off and Turn all layers off except selected layer
I've been using the slightly cumbersome command of LAYOFF to turn off a specific selected layer (without going into Layer properties), is there a more direct LISP routine or command to:
1. Turn selected layer off
2. Turn off all layers except selected layer
0
Comments
-
It's hard to imagine an easier way to turn off the layer of a selected object than the LAYOFF command, but to turn off all layers except the current one you can use a script that adds some parameters to the -LAYER command:
-Layer/Off/*/// (a slash indicates an Enter or Space)
I use MacroExpress to assign that sequence of keystrokes to a function key, but you can create a custom menu command that does the same thing. I don't know the syntax for menu scripts. In lisp, I think it would be:
[code](defun c:XX () (command "-layer" "off" "*" "" "" ""))[/code]0 -
I use these lisps to freeze and thaw an individual layer by selecting an entity.
[code](Defun C:FLAYR ()
(setq a (cdr (assoc 8 (entget (car (entsel))))))
(print a)
(IF (= a (GETVAR "CLAYER"))(COMMAND "-LA" "S" 0 ""))
(command "-LA" "F" a "")
)
(Defun C:TLAYR ()
(setq a (cdr (assoc 8 (entget (car (entsel))))))
(print a)
(command "-LA" "S" a "F" "*" "")
)[/code]0 -
Thanks for the help with the commands, I'm still trying to learn how to code in my own. I just worked out:To turn off all layers but a single specific one:^C^C^P(COMMAND "-LAYER" "OFF" "*" "N" "-ENTER")^P1. Set the layer I want to stay on as the Current Layer2. Trigger keyboard shortcut3. The "N" keeps the Current Layer on (Y would turn off every layer)Anthony - As far as LAYOFF goes, went set as a keyboard shortcut it works perfectly to turn off a specific layer.Thanks again0
-
1. Do you know about LAYMCUR? It makes a selected object's layer the current layer. I have that assigned to a function key also. F9, pick an object, then F10 = turn off all layers except the one the selected object is on.
2. Definitely keyboard shortcuts or aliases if you're going to use the command line. I use function keys instead of shift-key combinations, and single letter aliases for editing commands such as Copy and Move (C and M), and double letter aliases for drawing commands such as Line and Pline (LL and PP).
3. I used Enter instead of N because No is the default answer.0 -
My Function Keys are filling up quickly:F1: Midpoint between two pointsF2: divideF3: unassignedF4: Dimension EditI use three layer states: Architectural, Electrical, StructuralF5: Turns on architectural layer stateF6: Turns on electrical layer stateF7: Turns on structural layer stateF8: unassignedF9: Rotate object 90 degreesF10: PlotF11: Bring object to frontF12: Send object to backNow I'm spilling unto my CTRL+number keys:CTRL+1: Make object current layerCTRL+2: Turn off all layers except current layerCTRL+3: LAYOFFCTRL+4: Match propertiesNot to mention my mouse with five programmable keys:CopyMoveECSDeleteEnter0
-
David, it's often more useful to freeze/thaw layers than turn off/on.
I personally never use off/on.
And you don't have to answer the question about the current layer - it just stays thawed.0 -
If you are running out of function keys, you can create a new icon and associate a macro to it, I have one for turning off all layers, except for the current one. my macro is^c^c-layer;off;*;;;I have a similar macro to turn all layers on, and another one that turns all on and thaws them as well. Note that these sorts of macros can be more complex, but the most basic ones are just the keyboard commands. Note that ; is used to indicate a return.-Joe0
-
I have well over 200 routines, scripts etc including variations of those with typical inputs, which I use more or less often.
Many need text descriptions to show what they do, or remember them by, but if they weren't on pull down menus I doubt I would find function keys or make icons for them.0 -
"Turn off all layers except selected layer"The LAYISO command does that, at least if you select the OFF option for the other layers (LAYISO locks the other layers by default).0
This discussion has been closed.