Selecting objects in a layer

I am currently trying my hand at MaxScripting and have currently pulled most of my hair out. I am trying to automate some of our processes. The script I want to write would do the following:

Select a Layer
Select all objects on that layer
Apply a material
Add a UVW Map to those objects.

And then repeat the steps for 3-4 layers

Any advice or direction would be greatly appreciated.

Thanks!

Comments

pcpyro's picture

Please excuse my lack of

Please excuse my lack of Maxscript knowledge...

So far I have come up with this:

macros.run "Layers" "LayerSelect"

$.material = meditMaterials[21]
macros.run "Modifiers" "Uvwmap"
$ [#UVW_Mapping].maptype = 4
$ [#UVW_Mapping].length = 120
$ [#UVW_Mapping].width = 120
$ [#UVW_Mapping].height = 120
modPanel.addModToSelection (VRayDisplacementMod ()) ui:on
$ [#VRayDisplacementMod].texmap = meditMaterials[21].texmap_displacement
$ [#VRayDisplacementMod].amount = 12
$ [#VRayDisplacementMod].shift = -6
$ [#VRayDisplacementMod].type = 0

I can't get his part to work because the UVW and Vray Displacement doesn't select an individual piece to apply the modifiers to. I will try to find something else out.

Also is there a way to get LayerManager to select a layer by name and not number? We have default layers that come in as Concrete and Asphalt, but they can end up being different numbers in the list depending on what the additional layers are named.