Create layers from material

Hi,

I was wondering if there is a script out there that'll create layers from assigned materials, match the material name to the layer name and place all objects with a given material on the associated layer ?

And if it could batch process a string of .Max files that would be awesome :)

I need to export a bunch of Max objects as Revit content and Revit will only assign materials for imported objects by layer.

If anyone can help me out with this I would appreciate it very much.

Thanks,

JF

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Herbie's picture

Your script -batch

Your script -batch processing
It's not a batch process for each .max file.. but it does collect all the scene materials, assigns the names of those materials to new layers, then goes through every object and assigns them accordingly.

I threw in saving the scene as a new copy with the "_for_Revit" at the end..

for m in scenematerials do
(
	if LayerManager.getLayerFromName m.name == undefined
		then NewLayer = LayerManager.newLayerFromName m.name
	else NewLayer = LayerManager.getLayerFromName m.name
        for obj in objects do if obj.material.name == m.name do NewLayer.addNode obj
)
    saveMaxFile (getfilenamefile (maxfilename) + "_for_Revit.max") useNewFile: true

Hope this helps a bit..

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.