ShapeImporter
Description:
An utility class that supports conversion of geometry stored in an external format into a Revit geometry objects.
An utility class that supports conversion of geometry stored in an external format into a Revit geometry objects.
Remarks:
See ShapeImporterSourceFormat for the list of supported formats.
See ShapeImporterSourceFormat for the list of supported formats.
Inheritance Hierarchy:
System.Object
Autodesk.Revit.DB.ShapeImporter
System.Object
Autodesk.Revit.DB.ShapeImporter
public class ShapeImporter : IDisposable
public void ReadSATFile(Document revitDoc)
{
// Allow the user to select a SAT file.
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "SAT Files (*.sat)|*.sat";
if (DialogResult.OK == ofd.ShowDialog())
{
ShapeImporter shapeImporter = new ShapeImporter();
shapeImporter.InputFormat = ShapeImporterSourceFormat.SAT;
IList<GeometryObject> shapes = shapeImporter.Convert(revitDoc, ofd.FileName);
if (shapes.Count != 0)
{
using (Transaction tr = new Transaction(revitDoc, "Create a DirectShape"))
{
tr.Start();
DirectShape dsImportedSat = DirectShape.CreateElement(revitDoc, new ElementId(BuiltInCategory.OST_Walls));
dsImportedSat.SetShape(shapes);
tr.Commit();
}
}
}
}
| Name | Return Type | Description |
|---|---|---|
| ShapeImporter() | None | Default constructor. Initializes an instance of ShapeImporter that will automatically recognize the file format from its extension (ShapeImporterSourceFormat.Auto). |
| Name | Return Type | Description |
|---|---|---|
| Convert(Document, String) | IList<GeometryObject> | Converts the geometry stored in the external format into a collection of Revit geometry objects. |
| Dispose() | None | Releases all resources used by the |
| IsServiceAvailable() | bool | Checks whether the data conversion service is available. |
| SetDefaultLengthUnit(ImportUnit) | None | Sets the length unit to be used if not specified in the input SAT file. |
| Name | Return Type | Description |
|---|---|---|
| DefaultLengthUnit | ImportUnit | The length unit to be used if not specified in the input SAT file. |
| InputFormat | ShapeImporterSourceFormat | The format of the incoming data. |
| IsValidObject | bool | Specifies whether the .NET object represents a valid Revit entity. |