I find very useful routine to delete layers using laydel with wildcards in the name here:
http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-delete-layers-using-laydel-wi...
my question is:
Is it possible to modify some of these programs in this topic in order to isolate layers in a same way?
I tried to solve this issue but I have a problem: Layiso command used layers picked by user and I don't know how to take these layers names as initial values
Any help will by very appreciated.
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
Solved by hmsilva. Go to Solution.
That's a lot easier, since isolating Layers is just a function of having them On and all other Off, both of which [unlike deleting them] are achievable within the Layer command's regular options:
(setq laynames (getstring "\nEnter Layer Name(s) to isolate [wild-cards can be used]: "))
(command "_.layer" "_off" "*" "_yes" "_on" laynames "")
Or, if you will always want a group of Layer names with the same beginning, and to wild-card the rest:
(setq laybase (getstring "\nEnter start of Layer Names to isolate all that begin that way: "))
(command "_.layer" "_off" "*" "_yes" "_on" (strcat laybase "*") "")
You may also want to include something to set the current Layer to one of those that will be on, which makes it a little more complicated but is certainly doable. Or you may choose to answer "_no" to the question of whether to turn the current Layer off.
@apelbaum2014 wrote:
I find very useful routine to delete layers using laydel with wildcards in the name here:
http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-delete-layers-using-laydel-wi...
my question is:
Is it possible to modify some of these programs in this topic in order to isolate layers in a same way?
I tried to solve this issue but I have a problem: Layiso command used layers picked by user and I don't know how to take these layers names as initial values
Any help will by very appreciated.
Hi Igal,
perhaps something like this:
(defun c:demo ( / laynames ss) (if (and (setq laynames (getstring T "\nEnter Layer Name(s) to isolate 'wild-cards can be used': ")) (setq ss (ssget "_X" (list (cons 8 laynames) (cons 410 (getvar 'CTAB))))) ) (command "_.layiso" ss "") (prompt (strcat "\nNo objects found in layers " laynames "... ")) ) (princ) )
Hope this helps,
Henrique
Thank you for your efforts. Routine working good!
Now i need an "emulation" of LAYUNISO function. After invoking "demo" function for example regular LAYUNISO function can not return previous position...
I think on this step need to involve layerstate-save and layerstate-restore functions..
How can I do it?
@apelbaum2014 wrote:
Thank you for your efforts. Routine working good!
Now i need an "emulation" of LAYUNISO function. After invoking "demo" function for example regular LAYUNISO function can not return previous position...
I think on this step need to involve layerstate-save and layerstate-restore functions..
How can I do it?
You're welcome!
'regular LAYUNISO function can not return previous position...'
???
Command: DEMO
Enter Layer Name(s) to isolate 'wild-cards can be used': _*
_.layiso
Current setting: Hide layers, Viewports=Off
Select objects on the layer(s) to be isolated or [Settings]: 1814 found
Select objects on the layer(s) to be isolated or [Settings]:
6 layers have been isolated. Layer _model is current.
Command:
Command: LAYUNISO
Layers isolated by LAYISO command have been restored.
LAYUNISO command, will restore the previous layer state...
Henrique
@apelbaum2014 wrote:
.... Now i need an "emulation" of LAYUNISO function. ....
If you use a regular-Layer-command approach [such as suggested in Post 2], then the LAYERP command will take you back to the previous condition.