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

layer.FullPath returns differing results

$
0
0

@5chmidt wrote:

When using layer.FullPath on the DocObject layer it is returning the layer.Name rather than the full path. However once the layer has been added to the document, doc.Layers[layerIndex].FullPath gets the correct value.

Is this how the layer.FullPath was intended to function? Below is some example code.

import Rhino
import scriptcontext

parent = Rhino.DocObjects.Layer.GetDefaultLayerProperties()
parent.Name = "Parent"
parentIndex = scriptcontext.doc.Layers.Add(parent)
parentId = scriptcontext.doc.Layers[parentIndex].Id

child = Rhino.DocObjects.Layer.GetDefaultLayerProperties()
child.Name = "Child"
child.ParentLayerId = parentId

childIndex = scriptcontext.doc.Layers.Add(child)
childLayer = scriptcontext.doc.Layers[childIndex]

print child.FullPath        ## prints Child ##

print childLayer.FullPath   ## prints Parent::Child ##

Thanks,

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5892

Trending Articles