Layer from FileIO has reports FullPath property incorrectly

I’m using Rhino.FileIO to read a Rhino file obtained via File3dm.Read(filePath);
I can easily get the list of Layers belonging to the file object, but when I get the Layer’s “FullPath” property it just shows the layer name with no nesting information. am I missing something?

Hi Andrew,

Layers do not store their full path name. Full layer path names are generated, as needed, by a function the document’s layer table. Basically, the function check to see if the layer has a parent and, if so, prepends the parent’s name to the layer name. And then the parent layer check to see if it has a parent, etc., until no parent is found.

The layer’s collection in File3dm is just an ignorant collection. So if you want to generate full layer path names from layers in in File3dm, you need to write your own function.

Let me know if you need help with this.

– Dale

Here you go:

https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCsLayerPathName.cs

@dale I wonder if we can just fix this in RhinoCommon

Thanks for the thorough answer & example. Makes sense now. It seems to me that generally properties are “stored” rather than calculated - I wonder if “GetFullPath()” as a method rather than a property wouldn’t be clearer. In any case, I have what I need now so thanks again!!

1 Like

http://mcneel.myjetbrains.com/youtrack/issue/RH-34853