ShapeImporter
A utility class that supports conversion of geometry stored in an external format into a Revit geometry objects.
Inheritance Hierarchy
System.Object
Autodesk.Revit.DB.ShapeImporter
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class ShapeImporter : IDisposableThe ShapeImporter type exposes the following members.
Constructors
Name
Description
Public Method
ShapeImporter
Default constructor. Initializes an instance of ShapeImporter that will automatically recognize the file format from its extension (ShapeImporterSourceFormat.Auto).
Properties
Name
Description
Public Property
DefaultLengthUnit
The length unit to be used if not specified when the input is a unitless SAT file.
Public Property
InputFormat
The format of the incoming data.
Public Property
IsValidObject
Specifies whether the .NET object represents a valid Revit entity.
Methods
Name
Description
Public Method
Convert
Converts the geometry stored in the external format into a collection of Revit geometry objects.
Public Method
Dispose
Releases all resources used by the ShapeImporter
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object)
Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object)
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object)
Public Method
Static Member
IsServiceAvailable
Checks whether the data conversion service is available.
Public Method
SetDefaultLengthUnit
Sets the length unit to be used when the input is a unitless SAT file.
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object)
Remarks
See ShapeImporterSourceFormat for the list of supported formats.
Example
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(); } } }}