Appends an Item to the RebarContainer. Fills its data on base of the Rebar.
Namespace: Autodesk.Revit.DB.StructureAssembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since: 2016
Syntax
C# |
---|
public RebarContainerItem AppendItemFromCurves( RebarStyle style, RebarBarType barType, RebarHookType startHook, RebarHookType endHook, XYZ normal, IList<Curve> curves, RebarHookOrientation startHookOrient, RebarHookOrientation endHookOrient, bool useExistingShapeIfPossible, bool createNewShape ) |
Visual Basic |
---|
Public Function AppendItemFromCurves ( _ style As RebarStyle, _ barType As RebarBarType, _ startHook As RebarHookType, _ endHook As RebarHookType, _ normal As XYZ, _ curves As IList(Of Curve), _ startHookOrient As RebarHookOrientation, _ endHookOrient As RebarHookOrientation, _ useExistingShapeIfPossible As Boolean, _ createNewShape As Boolean _ ) As RebarContainerItem |
Visual C++ |
---|
public: RebarContainerItem^ AppendItemFromCurves( RebarStyle style, RebarBarType^ barType, RebarHookType^ startHook, RebarHookType^ endHook, XYZ^ normal, IList<Curve^>^ curves, RebarHookOrientation startHookOrient, RebarHookOrientation endHookOrient, bool useExistingShapeIfPossible, bool createNewShape ) |
Parameters
- style
- Type: Autodesk.Revit.DB.Structure..::..RebarStyle
The usage of the bar, "standard" or "stirrup/tie".
- barType
- Type: Autodesk.Revit.DB.Structure..::..RebarBarType
A RebarBarType element that defines bar diameter, bend radius and material of the rebar.
- startHook
- Type: Autodesk.Revit.DB.Structure..::..RebarHookType
A RebarHookType element that defines the hook for the start of the bar. If this parameter is nullNothingnullptra null reference (Nothing in Visual Basic), it means to create a rebar with no hook.
- endHook
- Type: Autodesk.Revit.DB.Structure..::..RebarHookType
A RebarHookType element that defines the hook for the end of the bar. If this parameter is nullNothingnullptra null reference (Nothing in Visual Basic), it means to create a rebar with no hook.
- normal
- Type: Autodesk.Revit.DB..::..XYZ
The normal to the plane that the rebar curves lie on.
- curves
- Type: System.Collections.Generic..::..IList<(Of <(<'Curve>)>)>
An array of curves that define the shape of the rebar curves. They must belong to the plane defined by the normal and origin. Bends and hooks should not be included in the array of curves.
- startHookOrient
- Type: Autodesk.Revit.DB.Structure..::..RebarHookOrientation
Defines the orientation of the hook plane at the start of the rebar with respect to the orientation of the first curve and the plane normal. Only two values are permitted: Value = Right: The hook is on your right as you stand at the end of the bar, with the bar behind you, taking the bar's normal as "up." Value = Left: The hook is on your left as you stand at the end of the bar, with the bar behind you, taking the bar's normal as "up."
- endHookOrient
- Type: Autodesk.Revit.DB.Structure..::..RebarHookOrientation
Defines the orientation of the hook plane at the end of the rebar with respect to the orientation of the last curve and the plane normal. Only two values are permitted: Value = Right: The hook is on your right as you stand at the end of the bar, with the bar behind you, taking the bar's normal as "up." Value = Left: The hook is on your left as you stand at the end of the bar, with the bar behind you, taking the bar's normal as "up."
- useExistingShapeIfPossible
- Type: System..::..Boolean
Attempts to assign a RebarShape from those existing in the document. If no shape matches, NewRebar returns or creates a new shape, according to the parameter createNewShape. When both parameters are "true", the behavior is the same as sketching rebar in the UI. At least one of these parameters must be "true". If the RebarShapeDefinesHooks flag in ReinforcementSettings has been set to false, and a RebarShape cannot be found with both matching curves and hooks, then this method will perform a second search, ignoring hook information.
- createNewShape
- Type: System..::..Boolean
Creates a shape in the document to match the curves, hooks, and style specified, and assigns it to the new rebar instance. Shape creation will not succeed unless one or more other shapes already exist in the document, and these shapes have enough shape parameters to define a shape for these curves.
Return Value
The Rebar Container Item.
Examples

void AddItemsToRebarContainer(RebarContainer container, FamilyInstance beam, RebarBarType barType, RebarHookType hookType) { // Define the rebar geometry information - Line rebar LocationCurve location = beam.Location as LocationCurve; XYZ origin = location.Curve.GetEndPoint(0); // create rebar along the length of the beam XYZ rebarLineEnd = location.Curve.GetEndPoint(1); Line line = Line.CreateBound(origin, rebarLineEnd); XYZ normal = new XYZ(1, 0, 0); Curve rebarLine = line.CreateOffset(0.5, normal); // Create the line rebar IList<Curve> curves = new List<Curve>(); curves.Add(rebarLine); RebarContainerItem item = container.AppendItemFromCurves(RebarStyle.Standard, barType, hookType, hookType, normal, curves, RebarHookOrientation.Right, RebarHookOrientation.Left, true, true); if (null != item) { // set specific layout for new rebar as fixed number, with 10 bars, distribution path length of 1.5' // with bars of the bar set on the same side of the rebar plane as indicated by normal // and both first and last bar in the set are shown item.SetLayoutAsFixedNumber(10, 1.5, true, true, true); } // Hide the new item in the active view container.SetItemHiddenStatus(container.Document.ActiveView, item.ItemIndex, true); }

Private Sub AddItemsToRebarContainer(container As RebarContainer, beam As FamilyInstance, barType As RebarBarType, hookType As RebarHookType) ' Define the rebar geometry information - Line rebar Dim location As LocationCurve = TryCast(beam.Location, LocationCurve) Dim origin As XYZ = location.Curve.GetEndPoint(0) ' create rebar along the length of the beam Dim rebarLineEnd As XYZ = location.Curve.GetEndPoint(1) Dim line__1 As Line = Line.CreateBound(origin, rebarLineEnd) Dim normal As New XYZ(1, 0, 0) Dim rebarLine As Curve = line__1.CreateOffset(0.5, normal) ' Create the line rebar Dim curves As IList(Of Curve) = New List(Of Curve)() curves.Add(rebarLine) Dim item As RebarContainerItem = container.AppendItemFromCurves(RebarStyle.Standard, barType, hookType, hookType, normal, curves, _ RebarHookOrientation.Right, RebarHookOrientation.Left, True, True) If item IsNot Nothing Then ' set specific layout for new rebar as fixed number, with 10 bars, distribution path length of 1.5' ' with bars of the bar set on the same side of the rebar plane as indicated by normal ' and both first and last bar in the set are shown item.SetLayoutAsFixedNumber(10, 1.5, True, True, True) End If ' Hide the new item in the active view container.SetItemHiddenStatus(container.Document.ActiveView, item.ItemIndex, True) End Sub
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions..::..ArgumentException | The input curves is empty. -or- The input curves contains at least one curve which is not a bound Line or bound Arc and is not supported for this operation. -or- curves do not form a valid CurveLoop. -or- The input curves contains at least one helical curve and is not supported for this operation. |
Autodesk.Revit.Exceptions..::..ArgumentNullException | A non-optional argument was NULL |
Autodesk.Revit.Exceptions..::..ArgumentOutOfRangeException | normal has zero length. -or- A value passed for an enumeration argument is not a member of that enumeration |
Autodesk.Revit.Exceptions..::..ArgumentsInconsistentException | Both useExistingShapeIfPossible and createNewShape are false. -or- curves contains non-fillet arcs with radii that are less than the minimum bend radius for the RebarBarType and bar style. |
Autodesk.Revit.Exceptions..::..DisabledDisciplineException | None of the following disciplines is enabled: Structural. |