/// <summary> /// Add stirrup bars into corbel with given options. /// </summary> /// <param name="options">Options for Rebar Creation</param> private void PlaceStirrupBars(CorbelReinforcementOptions options) { var filter = new FilteredElementCollector(options.RevitDoc) .OfClass(typeof(RebarShape)).ToElements().Cast <RebarShape>() .Where <RebarShape>(shape => shape.RebarStyle == RebarStyle.StirrupTie); RebarShape stirrupShape = null; foreach (RebarShape shape in filter) { if (shape.Name.Equals("T1")) { stirrupShape = shape; break; } } Trapezoid profileCopy = m_profile.Clone(); profileCopy.OffsetTop(-m_corbelCoverDistance - 0.5 * options.StirrupBarType.BarDiameter); profileCopy.OffsetLeft(-m_corbelCoverDistance - 0.5 * options.StirrupBarType.BarDiameter); profileCopy.OffsetBottom(m_hostDepth - m_hostCoverDistance - 0.5 * options.StirrupBarType.BarDiameter); profileCopy.OffsetRight(-m_corbelCoverDistance - 0.5 * options.StirrupBarType.BarDiameter); XYZ extruDir = (m_extrusionLine.GetEndPoint(1) - m_extrusionLine.GetEndPoint(0)).Normalize(); double offset = m_corbelCoverDistance + 0.5 * options.StirrupBarType.BarDiameter; XYZ origin = profileCopy.Vertical.GetEndPoint(0) + extruDir * offset; XYZ xAxis = extruDir; XYZ yAxis = (profileCopy.Vertical.GetEndPoint(1) - profileCopy.Vertical.GetEndPoint(0)).Normalize(); Rebar stirrupBars = Rebar.CreateFromRebarShape(options.RevitDoc, stirrupShape, options.StirrupBarType, m_corbel, origin, xAxis, yAxis); double xLength = m_extrusionLine.Length - 2 * offset; double yLength = profileCopy.Vertical.Length; stirrupBars.SetLayoutAsFixedNumber(options.StirrupBarCount + 1, profileCopy.Top.Length, false, false, true); stirrupBars.ScaleToBox(origin, xAxis * xLength, yAxis * yLength); ShowRebar3d(stirrupBars); double space = profileCopy.Top.Length / options.StirrupBarCount; double step = space * m_profile.Vertical.Length / (m_profile.Bottom.Length - m_profile.Top.Length); XYZ dirTop = (m_profile.Top.GetEndPoint(0) - m_profile.Top.GetEndPoint(1)).Normalize(); XYZ dirVertical = yAxis; XYZ deltaStep = dirTop * space + dirVertical * step; origin = profileCopy.Top.GetEndPoint(0) + extruDir * offset; int count = (int)((m_profile.Vertical.Length - m_corbelCoverDistance - 0.5 * options.StirrupBarType.BarDiameter) / step); for (int i = 1; i <= count; i++) { origin += deltaStep; Rebar stirrupBars2 = Rebar.CreateFromRebarShape(options.RevitDoc, stirrupShape, options.StirrupBarType, m_corbel, origin, xAxis, yAxis); stirrupBars2.ScaleToBox(origin, xAxis * xLength, yAxis * (yLength - i * step)); ShowRebar3d(stirrupBars2); } }
/// <summary> /// Add a multi-planar bar into corbel with given options. /// </summary> /// <param name="options">Options for Rebar Creation</param> private void PlaceMultiplanarRebar(CorbelReinforcementOptions options) { Trapezoid profileCopy = m_profile.Clone(); profileCopy.OffsetTop(-m_corbelCoverDistance - options.StirrupBarType.BarDiameter - 0.5 * options.MultiplanarBarType.BarDiameter); profileCopy.OffsetLeft(-m_corbelCoverDistance - 0.5 * options.MultiplanarBarType.BarDiameter); profileCopy.OffsetBottom(m_hostDepth - m_hostCoverDistance - options.HostStraightBarType.BarDiameter * 4 - options.StirrupBarType.BarDiameter); profileCopy.OffsetRight(-m_corbelCoverDistance - options.StirrupBarType.BarDiameter - 0.5 * options.StirrupBarType.BarDiameter); //m_profile.Draw(options.RevitDoc); //profileCopy.Draw(options.RevitDoc); XYZ origin, vx, vy; profileCopy.Boundary(out origin, out vx, out vy); XYZ vecX = vx.Normalize(); XYZ vecY = vy.Normalize(); RebarShape barshape = profileCopy.ConstructMultiplanarRebarShape(options.RevitDoc, 0.5 * options.MultiplanarBarType.StirrupTieBendDiameter); Rebar newRebar = Rebar.CreateFromRebarShape( options.RevitDoc, barshape, options.MultiplanarBarType, m_corbel, origin, vecX, vecY); XYZ extruDir = (m_extrusionLine.GetEndPoint(1) - m_extrusionLine.GetEndPoint(0)).Normalize(); double offset = m_corbelCoverDistance + options.StirrupBarType.BarDiameter + 0.5 * options.MultiplanarBarType.BarDiameter; newRebar.ScaleToBoxFor3D(origin + extruDir * (m_extrusionLine.Length - offset), vx, vy, m_extrusionLine.Length - 2 * offset); ShowRebar3d(newRebar); }
/// <summary> /// Add straight bars into corbel with given options. /// </summary> /// <param name="options">Options for Rebar Creation</param> private void PlaceStraightBars(CorbelReinforcementOptions options) { Trapezoid profileCopy = m_profile.Clone(); profileCopy.OffsetTop(-m_corbelCoverDistance); profileCopy.OffsetLeft(-m_corbelCoverDistance - options.MultiplanarBarType.BarDiameter - options.TopBarType.BarDiameter * 0.5); profileCopy.OffsetBottom(m_hostDepth - m_hostCoverDistance - options.StirrupBarType.BarDiameter - options.HostStraightBarType.BarDiameter); profileCopy.OffsetRight(-m_corbelCoverDistance); //m_profile.Draw(options.RevitDoc); //profileCopy.Draw(options.RevitDoc); XYZ extruDir = (m_extrusionLine.GetEndPoint(1) - m_extrusionLine.GetEndPoint(0)).Normalize(); double offset = m_corbelCoverDistance + options.StirrupBarType.BarDiameter + options.MultiplanarBarType.BarDiameter + 0.5 * options.TopBarType.BarDiameter; Line vetical = profileCopy.Vertical; XYZ delta = extruDir * offset; Curve barLine = Line.CreateBound(vetical.GetEndPoint(1) + delta, vetical.GetEndPoint(0) + delta); IList <Curve> barCurves = new List <Curve>(); barCurves.Add(barLine); Rebar bars = Rebar.CreateFromCurves(options.RevitDoc, RebarStyle.Standard, options.TopBarType, null, null, m_corbel, extruDir, barCurves, RebarHookOrientation.Left, RebarHookOrientation.Left, true, true); bars.SetLayoutAsFixedNumber(options.TopBarCount + 2, m_extrusionLine.Length - 2 * offset, true, false, false); ShowRebar3d(bars); }