LoadFamily Method (Document, IFamilyLoadOptions)


Loads the contents of this family document into another document.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)

Syntax

C#
public Family LoadFamily(
	Document targetDocument,
	IFamilyLoadOptions familyLoadOptions
)
Visual Basic
Public Function LoadFamily ( _
	targetDocument As Document, _
	familyLoadOptions As IFamilyLoadOptions _
) As Family
Visual C++
public:
Family^ LoadFamily(
	Document^ targetDocument, 
	IFamilyLoadOptions^ familyLoadOptions
)

Parameters

targetDocument
Type: Autodesk.Revit.DB Document
The target document which the family will be loaded into.
familyLoadOptions
Type: Autodesk.Revit.DB IFamilyLoadOptions
The interface implementation to use when responding to conflicts during the load operation.

Return Value

Reference of the family in the target document.

Remarks

If you are reloading an edited family back into the source document from which it was extracted, use this overload. This is because this overload allows you to respond to possible conflicts due to families already being present in the target document. The Revit API offers one automatic overload: RevitUIFamilyLoadOptions, which will show the same prompts to the user as seen during an interactive load.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException Thrown when the input argument-"targetDocument" or "familyLoadOptions"-is a null reference ( Nothing in Visual Basic) .
Autodesk.Revit.Exceptions InvalidOperationException Thrown when the current document is not a family document, or when the target document is modifiable (e.g. there is an uncommitted transaction) or doesn't support load of this kind of families (e.g. loading a model family to detail family is disallowed), or the load was cancelled due to a conflict and a False return from one of the interface methods, or this document is currently in a read-only state.
Autodesk.Revit.Exceptions ForbiddenForDynamicUpdateException Thrown if this method is called during dynamic update.

See Also