RebarCreateFromRebarShape Method |
Creates a new shape driven Rebar, as an instance of a RebarShape.
The instance will have the default shape parameters from the RebarShape,
and its location is based on the bounding box of the shape in the shape definition.
Hooks are removed from the shape before computing its bounding box.
If appropriate hooks can be found in the document, they will be assigned arbitrarily.
Namespace: Autodesk.Revit.DB.StructureAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic static Rebar CreateFromRebarShape(
Document doc,
RebarShape rebarShape,
RebarBarType barType,
Element host,
XYZ origin,
XYZ xVec,
XYZ yVec
)
Public Shared Function CreateFromRebarShape (
doc As Document,
rebarShape As RebarShape,
barType As RebarBarType,
host As Element,
origin As XYZ,
xVec As XYZ,
yVec As XYZ
) As Rebar
public:
static Rebar^ CreateFromRebarShape(
Document^ doc,
RebarShape^ rebarShape,
RebarBarType^ barType,
Element^ host,
XYZ^ origin,
XYZ^ xVec,
XYZ^ yVec
)
static member CreateFromRebarShape :
doc : Document *
rebarShape : RebarShape *
barType : RebarBarType *
host : Element *
origin : XYZ *
xVec : XYZ *
yVec : XYZ -> Rebar
Parameters
- doc Document
-
A document.
- rebarShape RebarShape
-
A RebarShape element that defines the shape of the rebar.
- barType RebarBarType
-
A RebarBarType element that defines bar diameter, bend radius and material of the rebar.
- host Element
-
The element to which the rebar belongs. The element must support rebar hosting;
[!:Autodesk::Revit::DB::Structure::RebarHostData].
- origin XYZ
-
The lower-left corner of the shape's bounding box will be placed at this point in the project.
- xVec XYZ
-
The x-axis in the shape definition will be mapped to this direction in the project.
- yVec XYZ
-
The y-axis in the shape definition will be mapped to this direction in the project.
Return Value
Rebar
The newly created Rebar instance, or
if the operation fails.
Exceptions
Example
private List<Rebar> CreateRebar(Document doc, Wall wall, RebarShape barShape, RebarBarType barType)
{
List<Rebar> newRebars = new List<Rebar>();
Rebar bar = Rebar.CreateFromRebarShape(doc, barShape, barType, wall, new XYZ(2, 0, 2), new XYZ(1, 0, 0), new XYZ(0, 0, 1));
doc.Regenerate();
newRebars.Add(bar);
double barLength = bar.TotalLength;
bar = Rebar.CreateFromRebarShape(doc, barShape, barType, wall, new XYZ(2 + barLength, 0, 2), new XYZ(1, 0, 0), new XYZ(0, 0, 1));
newRebars.Add(bar);
return newRebars;
}
Private Function CreateRebar(doc As Document, wall As Wall, barShape As RebarShape, barType As RebarBarType) As List(Of Rebar)
Dim newRebars As New List(Of Rebar)()
Dim bar As Rebar = Rebar.CreateFromRebarShape(doc, barShape, barType, wall, New XYZ(2, 0, 2), New XYZ(1, 0, 0), _
New XYZ(0, 0, 1))
doc.Regenerate()
newRebars.Add(bar)
Dim barLength As Double = bar.TotalLength
bar = Rebar.CreateFromRebarShape(doc, barShape, barType, wall, New XYZ(2 + barLength, 0, 2), New XYZ(1, 0, 0), _
New XYZ(0, 0, 1))
newRebars.Add(bar)
Return newRebars
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