Unfortunately, it also doesn’t work if I only input parent layer name.
I think it should be something like how to access active rhino document correctly.
var layer_index = doc.Layers.FindByFullPath("ParentLayerName::SubLayerName", -1);
if (layer_index > -1)
{
var objects = doc.Objects.FindByLayer(doc.Layers[layer_index]);
// to do...
}
RhinoObject is a wrapper around the actual geometry and has much more information than just the geometry. Likewise, GH_Mesh is the grasshopper wrapper. So basically you unwrap the Rhino object, and wrap the contents in a Grasshoper wrapper
RhinoObject meshObject; // assigned elsewhere
if (meshObject.Geometry is Mesh m)
{
GH_Mesh gh = new GH_Mesh(m);
A = gh;
}