CreateFromIFC Method


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: 16.0.0.0 (16.0.0.0)
Since: 2015

Syntax

C#
public static RevitLinkLoadResult CreateFromIFC(
	Document document,
	string ifcFilePath,
	string revitLinkedFilePath,
	bool recreateLink,
	RevitLinkOptions options
)
Visual Basic
Public Shared Function CreateFromIFC ( _
	document As Document, _
	ifcFilePath As String, _
	revitLinkedFilePath As String, _
	recreateLink As Boolean, _
	options As RevitLinkOptions _
) As RevitLinkLoadResult
Visual C++
public:
static RevitLinkLoadResult^ CreateFromIFC(
	Document^ document, 
	String^ ifcFilePath, 
	String^ revitLinkedFilePath, 
	bool recreateLink, 
	RevitLinkOptions^ options
)

Parameters

document
Type: Autodesk.Revit.DB Document
The document in which to create the Revit link.
ifcFilePath
Type: System String
The path of the associated IFC file. This must be a full path.
revitLinkedFilePath
Type: System String
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: System Boolean
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.DB RevitLinkOptions
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.Exceptions ArgumentException document is not a project document. -or- The input path "ifcFilePath" does not represent an IFC file. -or- document already contains a linked model at path revitLinkedFilePath. -or- The document is a cloud model.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions FileAccessException The model cannot be accessed due to lack of access privileges.
Autodesk.Revit.Exceptions FileArgumentNotFoundException There is not a valid Revit file at ifcFilePath's location -or- There is not a valid Revit file at revitLinkedFilePath's location
Autodesk.Revit.Exceptions InvalidOperationException Revit cannot customize worksets for this model.
Autodesk.Revit.Exceptions ModificationForbiddenException 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.Exceptions ModificationOutsideTransactionException The document has no open transaction.

See Also