Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4159

Material name to match Layer name

$
0
0

@soccerbatman wrote:

Hi everyone, I have been trying to make a script that materials names match their layers names. Here is what I have and it does not work:

import rhinoscriptsyntax as rs

def LayerNameToMaterial():
layers = rs.LayerNames()

for i in layers:
    objs = rs.ObjectsByLayer(i)
    index = rs.ObjectMaterialIndex(objs)
    if index==0:
        rs.MaterialName(objs, i)

LayerNameToMaterial()

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4159