Creates a new Revit link type from an existing Revit file created via import by reference of an asscoiated IFC file.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since: 2018
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- document
- Type: Autodesk.Revit.DBDocument
The document in which to create the Revit link.
- resourceReference
- Type: Autodesk.Revit.DBExternalResourceReference
An external resource reference describing the source of the IFC file used in creation.
- revitLinkedFilePath
- Type: SystemString
The path of the existing Revit file that contains elements created via an import by reference operation. This must be a full path.
- recreateLink
- Type: SystemBoolean
If true, the existing Revit file created via an import by reference operation will be updated based on the information in the IFC file. If false, the existing Revit file will be used as-is.
- options
- Type: Autodesk.Revit.DBRevitLinkOptions
An options class for loading Revit links.
Return Value
An object containing the results of creating and loading the Revit link type. It contains the ElementId of the new link.Remarks
This function is one of a series of steps necessary for linking an IFC file. To understand how it is used in context, please download the IFC open source code, and look in the Revit.IFC.Import project at Importer.ImportIFC(ImporterIFC importer), under the IFCImportAction.Link branch.
This function regenerates the input document. While the options argument allows specification of a path type, the input path argument must be a full path. Relative vs. absolute determines how Revit will store the path, but it needs a complete path to find the linked document initially.Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.ExceptionsArgumentException | document is not a project document. -or- document already contains a linked model at path revitLinkedFilePath. -or- The server referenced by the ExternalResourceReference does not exist or does not implement IExternalResourceServer. -or- The server referenced by the ExternalResourceReference cannot support IFC links. -or- The ExternalResourceReference (resourceReference) is not in a format that is supported by its server. |
Autodesk.Revit.ExceptionsArgumentNullException | A non-optional argument was null |
Autodesk.Revit.ExceptionsFileAccessException | The model cannot be accessed due to lack of access privileges. |
Autodesk.Revit.ExceptionsFileArgumentNotFoundException | There is not a valid Revit file at revitLinkedFilePath's location |
Autodesk.Revit.ExceptionsInvalidOperationException | The file is not allowed to access. -or- Revit cannot customize worksets for this model. |
Autodesk.Revit.ExceptionsModificationForbiddenException | The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements). -or- The document is being loaded, or is in the midst of another sensitive process. |
Autodesk.Revit.ExceptionsModificationOutsideTransactionException | The document has no open transaction. |