About using CreateFromRebarShape() & CreateFromCurves() of Rebar class
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I used part1 code to create rebar in structural framing, but the rebar is out of host element, and if doesn't set shapeID, it'll not be shown in activeview. But if create in floor element, by part2 code, it's ok. I checked these variable paras of two elements, and confirm paras in part1 code are I need and correct(at least I can't find one of them is wrong). The structural framing element and the floor element are both in same document. So, do I ignore or miss some details?
And if i use CreateFromRebarShape() method to create rebar in structural framing, how can I control rebars layout direction by API? E.g. : In picture3, two rebars is layout by SetLayoutAsFixedNumber(),I want to the above rebar be set on the right side of the lower rebar.
Line line = Line.CreateBound(p2, new XYZ(p2.X, p2.Y - _length, p2.Z)); Rebar rebar2 = Rebar.CreateFromCurves(document, RebarStyle.Standard, rebarType, null, null, element,
familyInstance.HandOrientation, new List<Curve>() { line }, RebarHookOrientation.Left,
RebarHookOrientation.Left, true, false);
if (rebar2 != null) { rebar2.GetShapeDrivenAccessor().SetLayoutAsSingle(); rebar2.GetShapeDrivenAccessor().SetRebarShapeId(rebarshape01.Id); rebar2.SetSolidInView((document.ActiveView as View3D), true); rebar2.SetUnobscuredInView(document.ActiveView, true); } -------------------------------------------------------------------------------------------- XYZ p1 = new XYZ(minPoint.X + cover, minPoint.Y + cover, maxPoint.Z - cover); XYZ p2 = new XYZ(minPoint.X + cover, minPoint.Y + cover + width, maxPoint.Z - cover); List<Curve> curvesX = new List<Curve>() { Line.CreateBound(p1, p2) }; Rebar X = Rebar.CreateFromCurves(document, RebarStyle.Standard, rebarType, hookType, hookType, element,
XYZ.BasisX, curvesX, RebarHookOrientation.Right, RebarHookOrientation.Right, true, true); if (X != null) { X.GetShapeDrivenAccessor().SetLayoutAsFixedNumber(item.RebarNumber, length, true, true, true); X.SetSolidInView((document.ActiveView as View3D), true); X.SetUnobscuredInView(document.ActiveView, true);}
Thanks for read or reply.