PathReinforcementCreate(Document, Element, IListCurve, Boolean, ElementId, ElementId, ElementId, ElementId) Method |
Creates a new PathReinforcement object from an array of curves. The newly created object will use a default Rebar Shape.
Namespace: Autodesk.Revit.DB.StructureAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic static PathReinforcement Create(
Document document,
Element hostElement,
IList<Curve> curveArray,
bool flip,
ElementId pathReinforcementTypeId,
ElementId rebarBarTypeId,
ElementId startRebarHookTypeId,
ElementId endRebarHookTypeId
)
Public Shared Function Create (
document As Document,
hostElement As Element,
curveArray As IList(Of Curve),
flip As Boolean,
pathReinforcementTypeId As ElementId,
rebarBarTypeId As ElementId,
startRebarHookTypeId As ElementId,
endRebarHookTypeId As ElementId
) As PathReinforcement
public:
static PathReinforcement^ Create(
Document^ document,
Element^ hostElement,
IList<Curve^>^ curveArray,
bool flip,
ElementId^ pathReinforcementTypeId,
ElementId^ rebarBarTypeId,
ElementId^ startRebarHookTypeId,
ElementId^ endRebarHookTypeId
)
static member Create :
document : Document *
hostElement : Element *
curveArray : IList<Curve> *
flip : bool *
pathReinforcementTypeId : ElementId *
rebarBarTypeId : ElementId *
startRebarHookTypeId : ElementId *
endRebarHookTypeId : ElementId -> PathReinforcement
Parameters
- document Document
-
The document.
- hostElement Element
-
The element that will host the PathReinforcement. The host can be a Structural Floor, Structural Wall, Structural Slab, or a Part created from a structural layer belonging to one of those element types.
- curveArray IListCurve
-
An array of curves that will define the outline of the PathReinforcement.
- flip Boolean
-
A flag controlling the bars relative to the curves.
- pathReinforcementTypeId ElementId
-
The id of the PathReinforcementType.
- rebarBarTypeId ElementId
-
The id of the RebarBarType.
- startRebarHookTypeId ElementId
-
The id of the RebarHookType for the start of the bar.
If this parameter is InvalidElementId, it means to create a rebar with no start hook.
- endRebarHookTypeId ElementId
-
The id of the RebarHookType for the end of the bar.
If this parameter is InvalidElementId, it means to create a rebar with no end hook.
Return Value
PathReinforcement
The newly created PathReinforcement.
ExceptionsException | Condition |
---|
ArgumentException |
The input curveArray is empty.
-or-
The input curveArray contains at least one helical curve and is not supported for this operation.
-or-
The element hostElement was not found in the given document.
-or-
the host Element is not a valid host for Area Reinforcement, Path Reinforcement, Fabric Area or Fabric Sheet.
-or-
curves in curveArray are not continuous and open.
-or-
pathReinforcementTypeId should refer to an Path Reinforcement Type element.
-or-
rebarBarTypeId should refer to an RebarBarType element.
-or-
startRebarHookTypeId should be invalid or refer to an RebarHookType element.
-or-
endRebarHookTypeId should be invalid or refer to an RebarHookType element.
|
ArgumentNullException |
A non-optional argument was null
|
ForbiddenForDynamicUpdateException |
This method may not be called during dynamic update.
|
Remarks
The method sets Rebar Shape of primary bars only.
ExamplePathReinforcement CreatePathReinforcement(Autodesk.Revit.DB.Document document, Wall wall)
{
List<Curve> curves = new List<Curve>();
LocationCurve location = wall.Location as LocationCurve;
XYZ start = location.Curve.GetEndPoint(0);
XYZ end = location.Curve.GetEndPoint(1);
curves.Add(Line.CreateBound(start, end));
ElementId defaultRebarBarTypeId = document.GetDefaultElementTypeId(ElementTypeGroup.RebarBarType);
ElementId defaultPathReinforcementTypeId = document.GetDefaultElementTypeId(ElementTypeGroup.PathReinforcementType);
ElementId defaultHookTypeId = ElementId.InvalidElementId;
PathReinforcement rein = PathReinforcement.Create(document, wall, curves, true, defaultPathReinforcementTypeId, defaultRebarBarTypeId, defaultHookTypeId, defaultHookTypeId);
if (null == rein)
{
throw new Exception("Create path reinforcement failed.");
}
TaskDialog.Show("Revit","Create path reinforcement succeed.");
return rein;
}
Private Function CreatePathReinforcement(document As Autodesk.Revit.DB.Document, wall As Wall) As PathReinforcement
Dim curves As New List(Of Curve)()
Dim location As LocationCurve = TryCast(wall.Location, LocationCurve)
Dim start As XYZ = location.Curve.GetEndPoint(0)
Dim [end] As XYZ = location.Curve.GetEndPoint(1)
curves.Add(Line.CreateBound(start, [end]))
Dim defaultRebarBarTypeId As ElementId = document.GetDefaultElementTypeId(ElementTypeGroup.RebarBarType)
Dim defaultPathReinforcementTypeId As ElementId = document.GetDefaultElementTypeId(ElementTypeGroup.PathReinforcementType)
Dim defaultHookTypeId As ElementId = ElementId.InvalidElementId
Dim rein As PathReinforcement = PathReinforcement.Create(document, wall, curves, True, defaultPathReinforcementTypeId, defaultRebarBarTypeId, _
defaultHookTypeId, defaultHookTypeId)
If rein Is Nothing Then
Throw New Exception("Create path reinforcement failed.")
End If
TaskDialog.Show("Revit", "Create path reinforcement succeed.")
Return rein
End Function
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