@shaunwu25 wrote:
Hi all,
I am trying to use c# script to access an external rhino file in my local document folder.
The question is I cannot retrieve the objects if it is located at the sub-layers.I am mainly using file.Objects.FindByLayer to access the layer.
I saw it is also possible to access by file.AllLayers.FindName(“sub-layer02”, GUID parentId);, but I am having difficulty to find the Guid parentId.Here is the code:
> string folder = @“C:\Users\Shaun Wu\Documents”;Rhino.FileIO.File3dm file = null; if (Directory.Exists(folder)) { var files = Directory.GetFiles(folder, "*.3dm"); file = Rhino.FileIO.File3dm.Read(files[0]); } A = file; B = file.Objects.FindByLayer("Layer01"); C = file.Objects.FindByLayer("Layer02");; D = file.Objects.FindByLayer("sub-layer02"); //file.AllLayers.FindName("sub-layer02", GUID parentId);
LayerExample.3dm (41.8 KB) example.gh (5.5 KB)
Thanks for the help.
Shaun
Posts: 4
Participants: 2