ScriptSpot

Forum topic · Scripts Wanted

Checking for layers and auto assigning materials

By paradoxmime · 2007-12-03

Description

I tried creating a small script which would assign materials to the appropriate layers. My only problem is that if a layer doesn't exist, the code stops and does not execute. Using this method:

$'Layer:ROOF_3D'.material = meditMaterials[1]
$'Layer:BRICK_WALL'.material = meditMaterials[2]
$'Layer:BRICK_COURSE'.material = meditMaterials[2]
ETC...

How could I check for a layer and if not present ignore it and move to the next line?

Also, this is kinda a 2 part request but each layer not only has set material defs but also they have material id's because of the multi/sub object materials being used. Notice the code above shows material[2] for both the Brick_wall and Brick_course layers. Brick_wall needs to be set to material id=1 and Brick_course set to =2.

Comments (2)

paulov · 2014-09-22

I've been looking for this feature for a while, could you please share your script?.

I'm so tired of assingning materials by layers to my dwg imports. I would love to have an automatic assigment tool because I've many layers and mostly use the same always.

vidorq · 2008-08-14

hi, your ideia is great. I´m tryng find a script like that, you solve the problem?