/// <summary> /// Create the CorbelFrame object with the given trapezoid face, corbel and its host information. /// </summary> /// <param name="corbel">Corbel instance</param> /// <param name="depthEdge">Depth Edge which is vertical with trapezoid face</param> /// <param name="leftEdge">Left edge of trapezoid</param> /// <param name="bottomEdge">Bottom edge of trapezoid</param> /// <param name="rightEdge">Right edge of trapezoid</param> /// <param name="topEdge">Top edge of trapezoid</param> /// <param name="revitDoc">Revit Document</param> /// <param name="trapezoidFace">Trapezoid Face</param> /// <param name="hostDepth">Corbel Host depth</param> /// <param name="hostTopCoverDistance">Corbel Host Top face cover distance</param> /// <returns>CorbelFrame object</returns> private static CorbelFrame ConstructCorbelFrame( FamilyInstance corbel, Edge depthEdge, Edge leftEdge, Edge bottomEdge, Edge rightEdge, Edge topEdge, Document revitDoc, PlanarFace trapezoidFace, double hostDepth, double hostTopCoverDistance) { XYZ leftEdgeDir = (leftEdge.Evaluate(1.0) - leftEdge.Evaluate(0.0)).Normalize(); XYZ leftEdgeV0 = leftEdge.Evaluate(0.0); Line leftEdgeLine = Line.get_Unbound(leftEdgeV0, leftEdgeDir); XYZ rightEdgeDir = (rightEdge.Evaluate(1.0) - rightEdge.Evaluate(0.0)).Normalize(); XYZ rightEdgeV0 = rightEdge.Evaluate(0.0); Line rightEdgeLine = Line.get_Unbound(rightEdgeV0, rightEdgeDir); XYZ topEdgeDir = (topEdge.Evaluate(1.0) - topEdge.Evaluate(0.0)).Normalize(); XYZ topEdgeV0 = topEdge.Evaluate(0.0); Line topEdgeLine = Line.get_Unbound(topEdgeV0, topEdgeDir); IntersectionResultArray intersections; topEdgeLine.Intersect(leftEdgeLine, out intersections); XYZ prevX = intersections.get_Item(0).XYZPoint; topEdgeLine.Intersect(rightEdgeLine, out intersections); XYZ nextX = intersections.get_Item(0).XYZPoint; XYZ edgeV0 = GetCommonVertex(bottomEdge, leftEdge); XYZ edgeV1 = GetCommonVertex(bottomEdge, rightEdge); Line topBoundLine = Line.get_Bound(nextX, prevX); Line leftBoundLine = Line.get_Bound(prevX, edgeV0); Line bottomBoundLine = Line.get_Bound(edgeV0, edgeV1); Line rightBoundLine = Line.get_Bound(edgeV1, nextX); Trapezoid profile = new Trapezoid(topBoundLine, leftBoundLine, bottomBoundLine, rightBoundLine); XYZ depthEdgeV0 = depthEdge.Evaluate(0.0); XYZ depthEdgeV1 = depthEdge.Evaluate(1.0); Line depthLine = null; if (depthEdgeV0.IsAlmostEqualTo(edgeV0)) { depthLine = Line.get_Bound(depthEdgeV0, depthEdgeV1); } else if (depthEdgeV1.IsAlmostEqualTo(edgeV0)) { depthLine = Line.get_Bound(depthEdgeV1, depthEdgeV0); } CorbelFrame frame = new CorbelFrame(corbel, profile, depthLine, hostDepth, hostTopCoverDistance); return(frame); }
/// <summary> /// Constructor to initialize the fields. /// </summary> /// <param name="corbel">Corbel family instance</param> /// <param name="profile">Trapezoid profile</param> /// <param name="path">Extrusion Line</param> /// <param name="hostDepth">Corbel Host Depth</param> /// <param name="hostTopCorverDistance">Corbel Host cover distance</param> public CorbelFrame(FamilyInstance corbel, Trapezoid profile, Line path, double hostDepth, double hostTopCorverDistance) { m_profile = profile; m_extrusionLine = path; m_corbel = corbel; m_hostDepth = hostDepth; m_hostCoverDistance = hostTopCorverDistance; // Get the cover distance of corbel from CommonCoverType. RebarHostData rebarHost = RebarHostData.GetRebarHostData(m_corbel); m_corbelCoverDistance = rebarHost.GetCommonCoverType().CoverDistance; }
/// <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); }
/// <summary> /// Create the CorbelFrame object with the given trapezoid face, corbel and its host information. /// </summary> /// <param name="corbel">Corbel instance</param> /// <param name="depthEdge">Depth Edge which is vertical with trapezoid face</param> /// <param name="leftEdge">Left edge of trapezoid</param> /// <param name="bottomEdge">Bottom edge of trapezoid</param> /// <param name="rightEdge">Right edge of trapezoid</param> /// <param name="topEdge">Top edge of trapezoid</param> /// <param name="revitDoc">Revit Document</param> /// <param name="trapezoidFace">Trapezoid Face</param> /// <param name="hostDepth">Corbel Host depth</param> /// <param name="hostTopCoverDistance">Corbel Host Top face cover distance</param> /// <returns>CorbelFrame object</returns> private static CorbelFrame ConstructCorbelFrame( FamilyInstance corbel, Edge depthEdge, Edge leftEdge, Edge bottomEdge, Edge rightEdge, Edge topEdge, Document revitDoc, PlanarFace trapezoidFace, double hostDepth, double hostTopCoverDistance) { XYZ leftEdgeDir = (leftEdge.Evaluate(1.0) - leftEdge.Evaluate(0.0)).Normalize(); XYZ leftEdgeV0 = leftEdge.Evaluate(0.0); Line leftEdgeLine = Line.get_Unbound(leftEdgeV0, leftEdgeDir); XYZ rightEdgeDir = (rightEdge.Evaluate(1.0) - rightEdge.Evaluate(0.0)).Normalize(); XYZ rightEdgeV0 = rightEdge.Evaluate(0.0); Line rightEdgeLine = Line.get_Unbound(rightEdgeV0, rightEdgeDir); XYZ topEdgeDir = (topEdge.Evaluate(1.0) - topEdge.Evaluate(0.0)).Normalize(); XYZ topEdgeV0 = topEdge.Evaluate(0.0); Line topEdgeLine = Line.get_Unbound(topEdgeV0, topEdgeDir); IntersectionResultArray intersections; topEdgeLine.Intersect(leftEdgeLine, out intersections); XYZ prevX = intersections.get_Item(0).XYZPoint; topEdgeLine.Intersect(rightEdgeLine, out intersections); XYZ nextX = intersections.get_Item(0).XYZPoint; XYZ edgeV0 = GetCommonVertex(bottomEdge, leftEdge); XYZ edgeV1 = GetCommonVertex(bottomEdge, rightEdge); Line topBoundLine = Line.get_Bound(nextX, prevX); Line leftBoundLine = Line.get_Bound(prevX, edgeV0); Line bottomBoundLine = Line.get_Bound(edgeV0, edgeV1); Line rightBoundLine = Line.get_Bound(edgeV1, nextX); Trapezoid profile = new Trapezoid(topBoundLine, leftBoundLine, bottomBoundLine, rightBoundLine); XYZ depthEdgeV0 = depthEdge.Evaluate(0.0); XYZ depthEdgeV1 = depthEdge.Evaluate(1.0); Line depthLine = null; if (depthEdgeV0.IsAlmostEqualTo(edgeV0)) { depthLine = Line.get_Bound(depthEdgeV0, depthEdgeV1); } else if (depthEdgeV1.IsAlmostEqualTo(edgeV0)) { depthLine = Line.get_Bound(depthEdgeV1, depthEdgeV0); } CorbelFrame frame = new CorbelFrame(corbel, profile, depthLine, hostDepth, hostTopCoverDistance); return frame; }