The Autodesk.Revit.DB.DWFImportOptions
class represents the options available for importing DWF files into a Revit project.
AutoCorrectOutOfDateDWF
- Gets or sets a boolean value indicating whether the import process should attempt to correct any out-of-date DWF files automatically.CenterInView
- Gets or sets a boolean value indicating whether the imported model should be centered in the view.ColorMode
- Gets or sets the color mode used for the import process. This can be set to either BlackAndWhite
or Color
.CurrentViewOnly
- Gets or sets a boolean value indicating whether only the current view should be imported into the project.Layers
- Gets or sets the layers that should be imported. This can be set to AllLayers
to import all layers or a specific layer name.MergeImportedLayers
- Gets or sets a boolean value indicating whether the imported layers should be merged into a single layer.ProjectCoordinates
- Gets or sets a boolean value indicating whether the imported geometry should be placed according to the project coordinates.Scale
- Gets or sets the scale factor applied to the imported model.// Create a new DWF import options instance
DWFImportOptions options = new DWFImportOptions();
// Set import options properties
options.AutoCorrectOutOfDateDWF = true;
options.ColorMode = DWFColorMode.BlackAndWhite;
options.CurrentViewOnly = true;
options.Layers = "MyLayer";
options.MergeImportedLayers = true;
options.ProjectCoordinates = true;
options.Scale = 2.0;
// Import DWF file into Revit project
Document document = Application.ActiveDocument;
document.Import("C:\Path\To\DWF\File.dwf", options);
When importing a DWF file, the following exceptions may be thrown:
ArgumentException
- thrown when an invalid argument is passed to the import method or an import option property is set to an invalid value.FileNotFoundException
- thrown when the specified DWF file cannot be found.InvalidOperationException
- thrown when the import process fails due to an unknown error.UnauthorizedAccessException
- thrown when the application does not have permission to access the specified DWF file.