ScriptSpot

Forum topic · Scripts Wanted

select object in layer

By jsrocha · 2011-01-21

Description

Hi guys,
i always wanted a script that i - in my totally scripting ignorance - think can be done easily. I need to select objetcs in a layer that is not necessarily the current one. Wich means, the script must store the current layer, then make the selected object´s layer current, then select all the objects in the new current layer and then set the stored layer back to current. Is it hard to script this? any good soul could do that? :)
so here´s my suggestion for a new script, thanks for your attention!
cheers,

Jsrocha

Comments (9)

for those who are wondering

crystal3d · 2020-03-07

it is basically a working "select children" command (the one in max does not work), it checks the selected object's layer and do a "select children" for that layer.

example:

you have one box object in a layer called "ceiling", you run this script and it selects all the other objects that are assigned to "ceiling".

thank you MIAU!
U

rachka · 2014-03-04

Thank you for this script! How can execute it via keyboard shortcut or set it on a quad or menu? Thanks!

.

miauu · 2014-03-04

Save this as MCR file and drag and drop it in Max viewport


macroscript 
category:"Tools"
tooltip:"Select object in layer"
buttonText:"Select object in layer"
(
	max modify mode
	for obj in selection do obj.layer.select true
)

Go to Tools category and assign a hotkey to Select object in layer.
You can change the category name and the name of the script before to install it.

Try this:

Garp · 2011-01-24

for obj in selection do obj.layer.select true

titane357 · 2011-01-25

I will add "max create mode" because in modify mode the selection take a loooong time.

jsrocha · 2011-01-25

Thanks man, this is exactly what i need!
cheers,

Jsrocha

jsrocha · 2011-01-24

Hey guys, thanks for your help!
what i really need is to select all the objects in the same layer as the SELECTED object. Is it possible to do that?
thanks in advance,

Jsrocha

Garp · 2011-01-21

Say the current layer is Layer01 and you want to select everything in Layer02.

(layerManager.getLayerFromName "Layer02").select true

The current layer is still Layer01.

edit: Oops. Sorry Swordslayer. I should have refreshed before posting.

Swordslayer · 2011-01-21

If you know the name of the layer, this should do the trick:

fn selectNodesInLayer layer_name =
(
	local nodes
	(LayerManager.getLayerFromName layer_name).nodes &nodes
	select nodes
)
selectNodesInLayer "The Name of the Layer Goes Here"