Replaces the group with the contents of the input file.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic void LoadFrom(
string fileName,
GroupLoadOptions options
)
Public Sub LoadFrom (
fileName As String,
options As GroupLoadOptions
)
public:
void LoadFrom(
String^ fileName,
GroupLoadOptions^ options
)
member LoadFrom :
fileName : string *
options : GroupLoadOptions -> unit
Parameters
- fileName String
-
The file to be used for the replacment.
- options GroupLoadOptions
-
Group load options.
ExceptionsException | Condition |
---|
ArgumentException |
Not a valid RVT file.
|
ArgumentNullException |
A non-optional argument was null
|
FileArgumentNotFoundException |
The given fileName does not exist.
|
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.
|
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.
|
ModificationOutsideTransactionException |
The document containing this GroupType has no open transaction.
|
Examplepublic 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;
}
}
Public Sub LoadGroup(ByVal group As Group, ByVal filePath As String)
Dim options As GroupLoadOptions = New GroupLoadOptions()
options.ReplaceDuplicatedGroups = True
options.SetDuplicateTypeNamesHandler(New CustomDuplicateTypeNamesHandler())
group.GroupType.LoadFrom(filePath, options)
End Sub
Friend Class CustomDuplicateTypeNamesHandler
Implements IDuplicateTypeNamesHandler
Public Function OnDuplicateTypeNamesFound(ByVal args As DuplicateTypeNamesHandlerArgs) As DuplicateTypeAction Implements IDuplicateTypeNamesHandler.OnDuplicateTypeNamesFound
Return DuplicateTypeAction.UseDestinationTypes
End Function
End Class
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also