Hi.
I’m trying to export all the objects on a layer. In this case, to an OBJ file, but I’m not sure the destination file really matters. The goal is to make this totally non-interactive, so that no user input is needed.
This is what I’ve got so far, derived from some existing code that exports everything. ‘layername’ is a string passed in containing the name of the layer I want to get the objects from. ‘destfile’ is the fully-qualified name of the file to export the data to.
RhinoDoc doc = RhinoDoc.ActiveDoc;
Rhino.DocObjects.RhinoObject[] rhobjs = doc.Objects.FindByLayer(layername);
if (rhobjs != null && rhobjs.Length > 0)
{
foreach (Rhino.DocObjects.RhinoObject obj in rhobjs)
{
obj.Select(true);
}
doc.Views.Redraw();
string RhinoCommand = @"_-ExportWithOrigin _SelAll _Enter _Enter " + "\"" + destfile + "\" _Enter _Enter _Enter";
bool rhinoScriptResult = RhinoApp.RunScript(RhinoCommand, true);
}
‘_SelAll’ exports everything. How do I tell it to export only the selected objects?
Thanks.
Don