Replaces the group with the contents of the input file.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since: 2024
Syntax
C# |
---|
public void LoadFrom( string fileName, GroupLoadOptions options ) |
Visual Basic |
---|
Public Sub LoadFrom ( _ fileName As String, _ options As GroupLoadOptions _ ) |
Visual C++ |
---|
public: void LoadFrom( String^ fileName, GroupLoadOptions^ options ) |
Parameters
- fileName
- Type: System..::..String
The file to be used for the replacment.
- options
- Type: Autodesk.Revit.DB..::..GroupLoadOptions
Group load options.
Examples

public void LoadGroup(Group group, string filePath) { GroupLoadOptions options = new GroupLoadOptions(); options.ReplaceDuplicatedGroups = true; options.SetDuplicateTypeNamesHandler(new CustomDuplicateTypeNamesHandler()); group.GroupType.LoadFrom(filePath, options); } class CustomDuplicateTypeNamesHandler : IDuplicateTypeNamesHandler { public DuplicateTypeAction OnDuplicateTypeNamesFound(DuplicateTypeNamesHandlerArgs args) { return DuplicateTypeAction.UseDestinationTypes; } }
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions..::..ArgumentException | Not a valid RVT file. |
Autodesk.Revit.Exceptions..::..ArgumentNullException | A non-optional argument was null |
Autodesk.Revit.Exceptions..::..FileArgumentNotFoundException | The given fileName does not exist. |
Autodesk.Revit.Exceptions..::..InvalidOperationException | The element "this GroupType" is in a document which is in an edit mode or is in family mode. -or- The element "this GroupType" does not belong to a project document. -or- The GroupType is not a Model group type and can't be reloaded. |
Autodesk.Revit.Exceptions..::..ModificationForbiddenException | The document containing this GroupType 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 containing this GroupType is being loaded, or is in the midst of another sensitive process. |
Autodesk.Revit.Exceptions..::..ModificationOutsideTransactionException | The document containing this GroupType has no open transaction. |