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

Creating sublayers with python

$
0
0

@siemen wrote:

Hi guys. I have a simple python script that creates a few layers with different colors which I think I based on a script I found from Helvetosaur here on the forum (I think). Now I’m wondering how I can create one Main layer and have the 3 layers be created as a sublayer. I’ve been trying this trick with Mainlayer::Sublayer but somehow I couldn’t get it to work. Anybody that could help me out here?

import scriptcontext as sc
import Rhino
import rhinoscriptsyntax as rs

layer = Rhino.DocObjects.Layer()

def AddLayers():
    layernames = ["Layer1", "Layer2", "Layer3"]
    Colors = [(255,0,0), (0,255,0), (0,255,255)]
    Count = 0
    for x in layernames:
        layer.Name = x
        sc.doc.Layers.Add(layer)
        rs.LayerColor(x, Colors[Count])
        Count += 1
AddLayers()

Posts: 9

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5837

Latest Images

Trending Articles



Latest Images