Here is how you would extract a list of layer names along with the geometry when reading dxf files
private void RunScript(string path, ref object geometry, ref object layerNames)
{
using( var doc = Rhino.RhinoDoc.CreateHeadless(null) )
{
doc.Import(path);
var geometryList = new System.Collections.Generic.List<GeometryBase>();
var names = new System.Collections.Generic.List<string>();
foreach(var obj in doc.Objects)
{
geometryList.Add(obj.Geometry.Duplicate());
var layer = doc.Layers[obj.Attributes.LayerIndex];
names.Add(layer.FullPath);
}
geometry = geometryList;
layerNames = names;
}
}