Hello,
I found this thread where I see I can use File3dm class to inject some geometries (LineCurve and Point3d in the thread’s example by @dale ).
My purpose is to start from the acrive document, browse the objects contained in the document and save N 3dm files, each containing one object. I don’t understand how to inject into del File3dm class the geometry from one of those objects. The code could be something like
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
foreach (var obj in doc.Objects)
{
SaveGeom(obj.Geometry);
}
}
private void SaveGeom(GeometryBase geom)
{
var destfile = "mygeom.3dm"; //ok, here I must have different filenames
using (var file = new File3dm())
{
var layer = new Layer { Name = "Default", Color = Color.Black };
file.Layers.Add(layer);
var layer_index = file.Layers.Count - 1;
var attributes = new ObjectAttributes { LayerIndex = layer_index };
//file.Objects.AddArc ?
//file.Objects.AddBrep ?
//file.Objects.AddCircle ?
//file.Objects.AddCurve ?
//file.Objects.AddExtrusion ?
file.Write(destfile, 6);
}
}
Where the code is commented, I would aspect to be able to call something like
file.Objects.AddGeometry(geom)
How can I achieve this?
Thank you for any hint.