Notifications
Clear all

[Closed] How can i hide/show multiple layers with one click

Hi all, im trying to hide/show multiple layers with one click but i cant

I try this, but only hide/show one layer:

	 (layerManager.getLayer 0).current = true

hide_layers=layerManager.getLayerFromName “Name01”

hide_layers.ishidden = true

	 (layerManager.getLayer 0).current = true

hide_layers=layerManager.getLayerFromName “Name02”

hide_layers.ishidden = false

i would like to select all layers have the name “mesh” or some like this , but no works:

	 (layerManager.getLayer 0).current = true

hide_layers=layerManager.getLayerFromName *“Name01”

hide_layers.ishidden = true

	 (layerManager.getLayer 0).current = true

hide_layers=layerManager.getLayerFromName *“Name02”

hide_layers.ishidden = false

Thank you in advance

4 Replies

This will loop through all layers, show any that have the name “mesh” in them, and hide any that do not:


for a=0 to layerManager.count-1 do (
	layer = layerManager.getLayer a
	layer.isHidden = not (matchPattern layer.name pattern:"*mesh*")
)

Ey man , thank you for the quick response !!!

Works perfectly , but i have a questions, is there any way to show the mesh layers without hiding the others, or hiding a concrete named layers? there will be always showed common layers.

Thank you very much for the help !!!

Alex .

This will unhide all layers with the word mesh. (I think that’s what you mean)


for a=0 to layerManager.count-1 do (
	layer = layerManager.getLayer a
	if matchPattern layer.name pattern:"*mesh*" do layer.isHidden = false
)


for a=0 to layerManager.count-1 do (
	layer = layerManager.getLayer a
	if matchPattern layer.name pattern:"*concrete*" do layer.isHidden = true
)

Ey man , woao! yes , it works perfecttly! , thanks a lot!
I am very grateful!

Alex