The Autodesk.Revit.DB.Structure.StructuralInstanceUsage
class represents the usage of a structural instance in the building model.
This class has the following properties:
Id
: Gets the element id of the structural instance usage.HostId
: Gets the element id of the host element of the structural instance usage.InstanceId
: Gets the element id of the structural instance used in the structural instance usage.IsAnalyzed
: Gets or sets a boolean value indicating whether the structural instance usage is analyzed.InstanceLocalTransform
: Gets or sets the local transform of the structural instance used in the structural instance usage.IsPrimaryUsage
: Gets or sets a boolean value indicating whether the structural instance usage is the primary usage of the structural instance.This class has the following methods:
ClearAnalyticalResults()
: Clears any analytical results associated with the structural instance usage.Delete()
: Deletes the structural instance usage from the building model.FindHost()
: Finds the host element of the structural instance usage.FindInstance()
: Finds the structural instance used in the structural instance usage.The following example demonstrates how to create a new structural instance usage in a building model:
// Find the host and instance elements
ElementId hostId = new ElementId(123);
ElementId instanceId = new ElementId(456);
// Create a new structural instance usage
using (Transaction t = new Transaction(doc))
{
t.Start("Create Structural Instance Usage");
StructuralInstanceUsage usage = StructuralInstanceUsage.Create(doc, hostId, instanceId);
t.Commit();
}
In this example, a new instance of the Autodesk.Revit.DB.Structure.StructuralInstanceUsage
class is created using the StructuralInstanceUsage.Create
method. The hostId
and instanceId
parameters are used to specify the host and instance elements for the new usage. The Transaction
class is used to group the creation of the new usage into a single undoable operation.