As I announced, I am currently on vacation.
Still, I don't want to leave you or The Building Coder completely abandoned for too long, so here is a quick question recently answered by my colleague Akira Kudo:
Question: How can I save a solid to a file, please?
I searched for an applicable API call, but without success.
I am not trying to save a Revit element, or I could use the existing Export methods.
My object is an Autodesk.Revit.DB.Solid instance generated by the Autodesk.Revit.DB.BooleanOperationsUtils class.
Answer: You could use the following workaround:
Here are pointers to different Revit SDK samples demonstrating all the various steps:
To create family document, you can call the Application.NewFamilyDocument Method.
FreeFormElement/CS/FreeFormElementUtils.cs(66): Document familyDoc = app.NewFamilyDocument( familyTemplate);
To create a component in the family from the given solid, you can call the FreeFormElement.Create method.
FreeFormElement/CS/FreeFormElementUtils.cs(113): RevitFreeFormElement element = Autodesk.Revit.DB .FreeFormElement.Create(familyDoc, block);
To create a 3D view, you can call the View3D.CreateIsometric method:
GeometryAPI/SlaveSymbolGeometry/CS/SlaveSymbolGeometry.cs(82): View3D instanceView = View3D.CreateIsometric( RevitDoc, View3DId);
Finally, you can use the Document.Export method to export a collection of views to a SAT file:
ImportExport/CS/Export/ExportSATData.cs(164): exported = m_activeDoc.Export(m_exportFolder, m_exportFileName, viewIds, satExportOptions);
Revit can only export specified views, not an individual solid. If the freeform element generated from the solid is the only element in the family, exporting the family 3D view has the same effect.
I hope you find this useful, and also enjoy this use of the Revit SDK samples to explore the application of the API methods in a fitting context for a specified real-world task.
Many thanks to Akira for providing this solution and illustrating this powerful approach.
And now, I return to my vacation pleasures... :-)