/// <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.get_EndPoint(1) - m_extrusionLine.get_EndPoint(0)).Normalize(); double offset = m_corbelCoverDistance + 0.5 * options.StirrupBarType.BarDiameter; XYZ origin = profileCopy.Vertical.get_EndPoint(0) + extruDir * offset; XYZ xAxis = extruDir; XYZ yAxis = (profileCopy.Vertical.get_EndPoint(1) - profileCopy.Vertical.get_EndPoint(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.get_EndPoint(0) - m_profile.Top.get_EndPoint(1)).Normalize(); XYZ dirVertical = yAxis; XYZ deltaStep = dirTop * space + dirVertical * step; origin = profileCopy.Top.get_EndPoint(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); } }
public ConcreteSectionFlexure GetConcreteBeam(double Width, double Height, double fc, bool IsBottomReinforced, params RebarInput[] rebarInput) { IConcreteSection Section = GetRectangularSection(Width, Height, fc); List <RebarPoint> LongitudinalBars = new List <RebarPoint>(); if (IsBottomReinforced == true) { foreach (var bar in rebarInput) { Rebar thisBar = new Rebar(bar.Area, new MaterialAstmA615(A615Grade.Grade60)); RebarPoint point = new RebarPoint(thisBar, new RebarCoordinate() { X = 0, Y = -Height / 2.0 + bar.Cover }); LongitudinalBars.Add(point); } } else { foreach (var bar in rebarInput) { Rebar thisBar = new Rebar(bar.Area, new MaterialAstmA615(A615Grade.Grade60)); RebarPoint point = new RebarPoint(thisBar, new RebarCoordinate() { X = 0, Y = Height / 2.0 - bar.Cover }); LongitudinalBars.Add(point); } } ConcreteSectionFlexure beam = new ConcreteSectionFlexure(Section, LongitudinalBars, log, ConfinementReinforcementType.NoReinforcement); return(beam); }
/// <summary> /// A special case function that can export a Rebar element as an IfcBuildingElementProxy for view-specific exports where the exact geometry of the rebar matters. /// </summary> /// <param name="exporterIFC">The ExporterIFC object.</param> /// <param name="rebarElement">The rebar element to be exported.</param> /// <param name="productWrapper">The ProductWrapper object.</param> /// <param name="cannotExportRebar">True if we tried to create an IFC entity but failed.</param> /// <returns>True if the rebar was exported here, false otherwise.</returns> /// <remarks>This functionality may be obsoleted in the future.</remarks> private static IFCAnyHandle ExportRebarAsProxyElementInView(ExporterIFC exporterIFC, Element rebarElement, ProductWrapper productWrapper, out bool cannotExportRebar) { IFCAnyHandle rebarEntity = null; cannotExportRebar = false; if (rebarElement is Rebar && ExporterCacheManager.ExportOptionsCache.FilterViewForExport != null) { // The only options handled here is IfcBuildingElementProxy. // Not Exported is handled previously, and ReinforcingBar vs Mesh will be handled later. string ifcEnumType; IFCExportType exportType = ExporterUtil.GetExportType(exporterIFC, rebarElement, out ifcEnumType); if (exportType == IFCExportType.IfcBuildingElementProxy || exportType == IFCExportType.IfcBuildingElementProxyType) { Rebar rebar = rebarElement as Rebar; GeometryElement rebarGeometry = rebar.GetFullGeometryForView(ExporterCacheManager.ExportOptionsCache.FilterViewForExport); if (rebarGeometry != null) { rebarEntity = ProxyElementExporter.ExportBuildingElementProxy(exporterIFC, rebarElement, rebarGeometry, productWrapper); } cannotExportRebar = IFCAnyHandleUtil.IsNullOrHasNoValue(rebarEntity); } } return(rebarEntity); }
public void LstRebarPopulate() { List <Point3D> points = new List <Point3D>(); LstRebar = new List <Rebar>(); LinearPath stirrupLinPath = (LinearPath)CadColumn.ColPath.Offset(-CadColumn.Cover * 1.2); Line[] stirrupBranches = stirrupLinPath.ConvertToLines(); for (int i = 0; i < stirrupBranches.Length; i++) { Line branch = stirrupBranches[i]; Rebar rebarCorner1, rebarCorner2, rebarMid; if (!points.Contains(branch.StartPoint)) { rebarCorner1 = new Rebar(branch.StartPoint); LstRebar.Add(rebarCorner1); } if (!points.Contains(branch.EndPoint)) { rebarCorner2 = new Rebar(branch.EndPoint); LstRebar.Add(rebarCorner2); } rebarMid = new Rebar(branch.MidPoint); LstRebar.Add(rebarMid); points.AddRange(branch.Vertices); } }
public void GeneralBeamFlexuralCapacityTopReturnsNominalValue() { double fc = 4000.0; FlexuralSectionFactory sf = new FlexuralSectionFactory(); IConcreteMaterial mat = GetConcreteMaterial(fc); List <Point2D> PolyPoints = new List <Point2D>() { new Point2D(-6.0, 0.0), new Point2D(-6.0, 12.0), new Point2D(6.0, 12.0), new Point2D(6.0, 0) }; Rebar thisBar = new Rebar(1.0, new MaterialAstmA615(A615Grade.Grade60)); var coord = new RebarCoordinate(0, 1.0); List <RebarPoint> RebarPoints = new List <RebarPoint>() { new RebarPoint(thisBar, coord) }; //GetGeneralSection(List<Point2D> PolygonPoints, //ConcreteMaterial Concrete, List<RebarPoint> RebarPoints, double b_w, double d) ConcreteSectionFlexure beam = sf.GetGeneralSection(PolyPoints, mat, RebarPoints, 12.0, 9.0); IStrainCompatibilityAnalysisResult MResult = beam.GetNominalFlexuralCapacity(FlexuralCompressionFiberPosition.Top); double M_n = MResult.Moment / 12000; double refValue = 51.32; double actualTolerance = EvaluateActualTolerance(M_n, refValue); Assert.True(actualTolerance <= tolerance); }
static public string getShapeNameAtIndex(Rebar rebar, int barPositionIndex) { string shapeName = ""; if (rebar == null) { return(shapeName); } RebarFreeFormAccessor accessor = rebar.GetFreeFormAccessor(); if (accessor == null) { return(shapeName); } if (rebar.Document == null) { return(shapeName); } ElementId idShape = accessor.GetShapeIdAtIndex(barPositionIndex); RebarShape shape = rebar.Document.GetElement(idShape) as RebarShape; if (shape == null) { return(shapeName); } shapeName = shape.Name; return(shapeName); }
public ConcreteSectionCompression GetConcreteExampleColumn() { double b = 16; double h = 16; double f_c = 5000; List <RebarPoint> LongitudinalBars = new List <RebarPoint>(); Rebar thisBar1 = new Rebar(4, new MaterialAstmA615(A615Grade.Grade60)); RebarPoint point1 = new RebarPoint(thisBar1, new RebarCoordinate() { X = 0, Y = -h / 2.0 + 2.5 }); LongitudinalBars.Add(point1); Rebar thisBar2 = new Rebar(4, new MaterialAstmA615(A615Grade.Grade60)); RebarPoint point2 = new RebarPoint(thisBar2, new RebarCoordinate() { X = 0, Y = h / 2.0 - 2.5 }); LongitudinalBars.Add(point2); ConcreteSectionCompression column = GetConcreteCompressionMember(b, h, f_c, LongitudinalBars, CompressionMemberType.NonPrestressedWithTies); return(column); }
public void BeamReturnsphiMn() { var ConcreteMaterial = new Kodestruct.Concrete.ACI318_14.Materials.ConcreteMaterial(6000, ACI.Entities.ConcreteTypeByWeight.Normalweight, null); FlexuralSectionFactory flexureFactory = new FlexuralSectionFactory(); double b = 16; double h = 40; double f_y = 60000; RebarMaterialGeneral LongitudinalRebarMaterial = new RebarMaterialGeneral(f_y); List <RebarPoint> LongitudinalBars = new List <RebarPoint>(); Rebar TopRebar = new Rebar(4, LongitudinalRebarMaterial); RebarPoint TopPoint = new RebarPoint(TopRebar, new RebarCoordinate() { X = 0, Y = h / 2.0 - 3 }); LongitudinalBars.Add(TopPoint); Rebar BottomRebar = new Rebar(4, LongitudinalRebarMaterial); RebarPoint BottomPoint = new RebarPoint(BottomRebar, new RebarCoordinate() { X = 0, Y = -h / 2.0 + 3 }); LongitudinalBars.Add(BottomPoint); CrossSectionRectangularShape shape = new CrossSectionRectangularShape(ConcreteMaterial, null, b, h); IConcreteFlexuralMember fs = new ConcreteSectionFlexure(shape, LongitudinalBars, null, ConfinementReinforcementType.Ties); ConcreteFlexuralStrengthResult result = fs.GetDesignFlexuralStrength(FlexuralCompressionFiberPosition.Top); }
//Detailed calculation public TensionLapSplice ( IConcreteMaterial Concrete, Rebar Bar1, Rebar Bar2, double ClearSpacing, double ClearCover, bool IsTopRebar, double A_tr, double s_tr, double n, TensionLapSpliceClass SpliceClass, ICalcLog log ) : base(log) { this.Concrete = Concrete; this.Bar1 = Bar1; this.Bar2 = Bar2; this.ClearSpacing = ClearSpacing; this.ClearCover = ClearCover; this.IsTopRebar = IsTopRebar; this.A_tr = A_tr; this.s_tr = s_tr; this.n = n; this.SpliceClass = SpliceClass; CalculateValuesDetailed(); }
CurveElement getSelectedCurveElement(Rebar bar, RebarUpdateCurvesData data) { RebarFreeFormAccessor barAccess = bar.GetFreeFormAccessor(); ElementId id = new ElementId(bar.LookupParameter(AddSharedParams.m_CurveIdName).AsInteger()); return(data.GetDocument().GetElement(id) as CurveElement); }
//Basic calculation public TensionLapSplice ( IConcreteMaterial Concrete, Rebar Bar1, Rebar Bar2, bool MeetsRebarSpacingAndEdgeDistance, bool HasMinimumTransverseReinforcement, bool IsTopRebar, TensionLapSpliceClass SpliceClass, ICalcLog log ) : base(log) { this.Concrete = Concrete; this.Bar1 = Bar1; this.Bar2 = Bar2; this.MeetsRebarSpacingAndEdgeDistance = MeetsRebarSpacingAndEdgeDistance; this.HasMinimumTransverseReinforcement = HasMinimumTransverseReinforcement; this.SpliceClass = SpliceClass; this.IsTopRebar = IsTopRebar; this.A_tr = A_tr; this.s_tr = s_tr; this.n = n; CalculateValuesBasic(); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Document doc = commandData.Application.ActiveUIDocument.Document; UIDocument uidoc = commandData.Application.ActiveUIDocument; View view = doc.ActiveView; List <Element> rebars = RebarSelectHelper.GetSelectedOrAll(uidoc); using (Transaction t1 = new Transaction(doc, "Set Unobscured in View")) { t1.Start(); foreach (Element rebar in rebars) { if (rebar is RebarInSystem) { RebarInSystem r = (RebarInSystem)rebar; if (!r.IsUnobscuredInView(view)) { r.SetUnobscuredInView(view, true); } } if (rebar is Rebar) { Rebar r = (Rebar)rebar; if (!r.IsUnobscuredInView(view)) { r.SetUnobscuredInView(view, true); } } } t1.Commit(); } return(Result.Succeeded); }
/// <summary> /// Add straight bars into corbel Host to anchor corbel stirrup bars. /// </summary> /// <param name="options">Options for Rebar Creation</param> private void PlaceCorbelHostBars(CorbelReinforcementOptions options) { Trapezoid profileCopy = m_profile.Clone(); profileCopy.OffsetBottom(m_hostDepth - m_hostCoverDistance - options.HostStraightBarType.BarDiameter * 0.5 - options.StirrupBarType.BarDiameter); //profileCopy.Draw(options.RevitDoc); XYZ extruDir = (m_extrusionLine.GetEndPoint(1) - m_extrusionLine.GetEndPoint(0)).Normalize(); double offset = m_corbelCoverDistance + options.StirrupBarType.BarDiameter + options.HostStraightBarType.BarDiameter * 0.5; XYZ delta = extruDir * offset; XYZ pt1 = profileCopy.Bottom.GetEndPoint(0) + delta; XYZ pt2 = profileCopy.Bottom.GetEndPoint(1) + delta; Curve barLine = Line.CreateBound(pt1, pt2); IList <Curve> barCurves = new List <Curve>(); barCurves.Add(barLine); Rebar bars = Rebar.CreateFromCurves( options.RevitDoc, RebarStyle.Standard, options.HostStraightBarType, null, null, m_corbel.Host, extruDir, barCurves, RebarHookOrientation.Left, RebarHookOrientation.Left, true, true); bars.GetShapeDrivenAccessor().SetLayoutAsFixedNumber(2, m_extrusionLine.Length - 2 * offset, true, true, true); ShowRebar3d(bars); }
private static string GetDiameter(Rebar rebar) { Parameter diameterParam = rebar.get_Parameter(BuiltInParameter.REBAR_BAR_DIAMETER); ForgeTypeId unitType = diameterParam.GetUnitTypeId(); double diameter = diameterParam.AsDouble(); diameter = UnitUtils.ConvertFromInternalUnits(diameter, unitType); return "ø" + diameter.ToString(); }
public override void ReinforcementPopulate() { LinearPath BoundaryPath = new LinearPath(Slab.LinPathSlab.Vertices.Select(e => new Point3D(e.X, e.Y, e.Z - DefaultValues.SlabThinkess + DefaultValues.ColumnCover)).ToArray()); List <Line> lstBoundaryLines = CadHelper.BoundaryLinesGet(BoundaryPath); int nLong = Convert.ToInt32(lstBoundaryLines[0].Length() / DefaultValues.LongBarSpacing); int nTransverse = Convert.ToInt32(lstBoundaryLines[1].Length() / DefaultValues.LongBarSpacing); //Vector3D uvLong = MathHelper.UnitVector3DFromPt1ToPt2(lstBoundaryLines[0].StartPoint, lstBoundaryLines[0].EndPoint); //Vector3D uvTransverse = MathHelper.UnitVector3DFromPt1ToPt2(lstBoundaryLines[1].StartPoint, lstBoundaryLines[1].EndPoint); for (int i = 0; i < nTransverse; i++) { Line rftTransverse = lstBoundaryLines[0].Offset(DefaultValues.LongBarSpacing * -i, Vector3D.AxisZ) as Line; List <Line> lstRftLines = CadHelper.LinesTrimWithPolygon(Slab.LinPathSlab, rftTransverse); for (int j = 0; j < lstRftLines.Count; j++) { Rebar rebar = new Rebar(new LinearPath(lstRftLines[j].Vertices)); RFT.Add(rebar); } } for (int i = 0; i < nLong; i++) { Line rftLong = lstBoundaryLines[1].Offset(DefaultValues.LongBarSpacing * -i, Vector3D.AxisZ) as Line; List <Line> lstRftLines = CadHelper.LinesTrimWithPolygon(Slab.LinPathSlab, rftLong); for (int j = 0; j < lstRftLines.Count; j++) { Rebar rebar = new Rebar(new LinearPath(lstRftLines[j].Vertices)); RFT.Add(rebar); } } for (int i = 0; i < Slab.Openings.Count; i++) { List <Rebar> lstRebar = new List <Rebar>(); for (int k = 0; k < RFT.Count; k++) { if (MathHelper.IsLineSegmentIntersectingPolygon(Slab.Openings[i].LinPathOpening, new Line(RFT[k].LinearPath.StartPoint, RFT[k].LinearPath.EndPoint))) { lstRebar.Add(RFT[k]); } } OpeningsRFT.AddRange(lstRebar); } for (int i = 0; i < OpeningsRFT.Count; i++) { RFT.Remove(OpeningsRFT[i]); } }
public static Dictionary <string, object> StraightBarTensionLapSpliceLengthDetailed(Concrete.ACI318.General.Concrete.ConcreteMaterial ConcreteMaterial, double d_b1, double d_b2, RebarMaterial RebarMaterial, string RebarSpliceClass = "B", string RebarCoatingType = "Uncoated", string RebarCastingPosition = "Top", double s_clear = 3, double c_c = 1.5, double A_tr = 0.44, double s_tr = 12, double n = 5, string Code = "ACI318-14") { //Default values double l_st = 0; //Calculation logic: IRebarMaterial mat = RebarMaterial.Material; bool IsEpoxyCoated = false; switch (RebarCoatingType) { case "Uncoated": IsEpoxyCoated = false; break; case "EpoxyCoated": IsEpoxyCoated = true; break; default: throw new Exception("Unrecognized rebar coating. Please check string input"); break; } Rebar rebar1 = new Rebar(d_b1, IsEpoxyCoated, mat); Rebar rebar2 = new Rebar(d_b2, IsEpoxyCoated, mat); bool IsTopRebar = false; switch (RebarCastingPosition) { case "Other": IsTopRebar = false; break; case "Top": IsTopRebar = true; break; default: throw new Exception("Unrecognized rebar casting position. Please check string input"); break; } TensionLapSpliceClass _RebarSpliceClass; bool IsValidRebarSpliceClass = Enum.TryParse(RebarSpliceClass, true, out _RebarSpliceClass); if (IsValidRebarSpliceClass == false) { throw new Exception("Failed to convert string. RebarSpliceClass not recognzed (A and B are acceptable inputs). Please check input"); } CalcLog log = new CalcLog(); TensionLapSplice ls = new TensionLapSplice(ConcreteMaterial.Concrete, rebar1, rebar2, s_clear, c_c, IsTopRebar, A_tr, s_tr, n, _RebarSpliceClass, log); l_st = ls.Length; return(new Dictionary <string, object> { { "l_st", l_st } }); }
public static Dictionary <string, object> StraightBarTensionLapSpliceLengthBasic(Concrete.ACI318.General.Concrete.ConcreteMaterial ConcreteMaterial, double d_b1, double d_b2, RebarMaterial RebarMaterial, string RebarSpliceClass = "B", string RebarCoatingType = "Uncoated", string RebarCastingPosition = "Top", double ExcessRebarRatio = 1.0, bool MeetsRebarSpacingAndEdgeDistance = true, bool HasMinimumTransverseReinforcement = false, string Code = "ACI318-14") { //Default values double l_st = 0; //Calculation logic: IRebarMaterial mat = RebarMaterial.Material; bool IsEpoxyCoated = false; switch (RebarCoatingType) { case "Uncoated": IsEpoxyCoated = false; break; case "EpoxyCoated": IsEpoxyCoated = true; break; default: throw new Exception("Unrecognized rebar coating. Please check string input"); } Rebar rebar1 = new Rebar(d_b1, IsEpoxyCoated, mat); Rebar rebar2 = new Rebar(d_b2, IsEpoxyCoated, mat); bool IsTopRebar = false; switch (RebarCastingPosition) { case "Other": IsTopRebar = false; break; case "Top": IsTopRebar = true; break; default: throw new Exception("Unrecognized rebar casting position. Please check string input"); } TensionLapSpliceClass _RebarSpliceClass; bool IsValidRebarSpliceClass = Enum.TryParse(RebarSpliceClass, true, out _RebarSpliceClass); if (IsValidRebarSpliceClass == false) { throw new Exception("Failed to convert string. RebarSpliceClass not recognzed (A and B are acceptable inputs). Please check input"); } CalcLog log = new CalcLog(); TensionLapSplice d = new TensionLapSplice(ConcreteMaterial.Concrete, rebar1, rebar2, MeetsRebarSpacingAndEdgeDistance, HasMinimumTransverseReinforcement, IsTopRebar, _RebarSpliceClass, log); l_st = d.Length; return(new Dictionary <string, object> { { "l_st", l_st } }); }
public void getSubElement() { UIDocument uiDoc = this.ActiveUIDocument; Document doc = uiDoc.Document; View myView = doc.ActiveView; Reference myRef = uiDoc.Selection.PickObject(ObjectType.Element, "Pick a rebar..."); Rebar myRebar = doc.GetElement(myRef) as Rebar; TaskDialog.Show("abc", "Has: " + myRebar.NumberOfBarPositions.ToString()); ReferenceArray myRefAr = new ReferenceArray(); int myNumberRebar = (int)myRebar.NumberOfBarPositions; if (myNumberRebar > 1) { for (int i = 0; i < myNumberRebar; i++) { List <Curve> centerLines = myRebar.GetCenterlineCurves(false, false, false, MultiplanarOption.IncludeOnlyPlanarCurves, 0) as List <Curve>; foreach (Curve myCurBar in centerLines) { if (myCurBar is Line) { Line myLine = myCurBar as Line; Reference myRefLine = myLine.Reference; myRefAr.Append(myRefLine); break; } } } } TaskDialog.Show("abc", myRefAr.Size.ToString()); setCurrentViewAsWorkPlan(); XYZ myDimPoint_1 = uiDoc.Selection.PickPoint("Pick Point To Place Dimension...."); XYZ myDimPoint_2 = new XYZ(myDimPoint_1.X + 5, myDimPoint_1.Y, myDimPoint_1.Z); Line dimLine = Line.CreateBound(myDimPoint_1, myDimPoint_2); using (Transaction trans = new Transaction(doc, "Create linear Dimension")) { trans.Start(); Dimension myDim = doc.Create.NewDimension(doc.ActiveView, dimLine, myRefAr); trans.Commit(); } }
public void LstRebarPopulate() { LinearPath rftPath = CadWall.LinPathWall.Offset(DefaultValues.WallCover * -1) as LinearPath; Line[] rftPathLines = rftPath.ConvertToLines(); Line longDirLine = null; Line shortDirLine = null; double longDirLength = double.MinValue; double shortDirLength = double.MaxValue; for (int i = 0; i < rftPathLines.Length; i++) { if (rftPathLines[i].Length() > longDirLength) { longDirLine = rftPathLines[i]; longDirLength = rftPathLines[i].Length(); } if (rftPathLines[i].Length() < shortDirLength) { shortDirLine = rftPathLines[i]; shortDirLength = rftPathLines[i].Length(); } } Vector3D uvLength = MathHelper.UnitVector3DFromPt1ToPt2(longDirLine.StartPoint, longDirLine.EndPoint); double dia = DefaultValues.BarDiameter; Vector3D uvWidth; if (longDirLine.Vertices.Contains(shortDirLine.StartPoint)) { uvWidth = MathHelper.UnitVector3DFromPt1ToPt2(shortDirLine.StartPoint, shortDirLine.EndPoint); } else { uvWidth = MathHelper.UnitVector3DFromPt1ToPt2(shortDirLine.EndPoint, shortDirLine.StartPoint); } //placement int nRebar = Convert.ToInt32(longDirLine.Length() / DefaultValues.LongBarSpacing); for (int i = 0; i < nRebar; i++) { Point3D locationPt1 = longDirLine.StartPoint + uvLength * DefaultValues.LongBarSpacing * i; Point3D locationPt2 = locationPt1 + uvWidth * shortDirLength; Rebar rebar1 = new Rebar(locationPt1); Rebar rebar2 = new Rebar(locationPt2); LstRebar.Add(rebar1); LstRebar.Add(rebar2); } }
/// <summary> /// Show the given rebar as solid in 3d view. /// </summary> /// <param name="rebar">Rebar to show in 3d view as solid</param> private void ShowRebar3d(Rebar rebar) { var filter = new FilteredElementCollector(rebar.Document) .OfClass(typeof(View3D)); foreach (View3D view in filter) { rebar.IsUnobscuredInView(view); rebar.SetSolidInView(view, true); } }
/// <summary> /// The helper function to changed rebar number and spacing properties /// </summary> /// <param name="bar">The rebar instance which need to modify</param> /// <param name="number">The rebar number want to set</param> /// <param name="spacing">The spacing want to set</param> protected static void SetRebarSpaceAndNumber(Rebar bar, int number, double spacing) { // Asset the parameter is valid if (null == bar || 2 > number || 0 > spacing) { return; } // Change the rebar number and spacing properties bar.GetShapeDrivenAccessor().SetLayoutAsNumberWithSpacing(number, spacing, true, true, true); }
/// <summary> /// Create the rebar at the bottom of beam /// </summary> /// <returns>true if the creation is successful, otherwise false</returns> public bool FillBottomBars() { // get the geometry information of the bottom rebar RebarGeometry geomInfo = m_geometry.GetBottomRebar(); // create the rebar Rebar rebar = PlaceRebars(m_bottomType, null, null, geomInfo, RebarHookOrientation.Left, RebarHookOrientation.Left); return(null != rebar); }
public bool AllowElement(Element elem) { if (elem is Rebar) { Rebar rb = elem as Rebar; if (rb.LookupParameter("Style").AsInteger() == 1) { return(true); } } return(false); }
public bool AllowElement(Element elem) { if (elem is Rebar) { Rebar rb = elem as Rebar; if (rb.LookupParameter("Type").AsString() == "Lockhead") { return(true); } } return(false); }
private static string GetComments(Rebar rebar) { string comments = rebar.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS).AsString(); if (comments == "") { return ""; } else { return " " + comments; } }
private static string GetPartition(Rebar rebar) { string partition = rebar.get_Parameter(BuiltInParameter.NUMBER_PARTITION_PARAM).AsString(); if (partition == "") { return ""; } else { return "-" + partition; } }
/// <summary> /// Get Transformed Centerline curves at position. /// This method extracts the centerlinecurves for a rebar set at a given index and transforms them to the correct position. /// </summary> /// <param name="rebar"></param> /// <param name="barPosIndex"></param> /// <returns></returns> public static IList<Curve> GetTransformedCenterLineCurvesAtPostition(Rebar rebar, int barPosIndex) { RebarShapeDrivenAccessor sda = rebar.GetShapeDrivenAccessor(); Transform transform = sda.GetBarPositionTransform(barPosIndex); IList<Curve> curves = rebar.GetCenterlineCurves(false, false, false, MultiplanarOption.IncludeOnlyPlanarCurves, barPosIndex); IList<Curve> transformedCurves = new List<Curve>(); foreach (Curve curve in curves) { transformedCurves.Add(curve.CreateTransformed(transform)); } return transformedCurves; }
public ConcreteSectionFlexure GetNonPrestressedDoublyReinforcedRectangularSection(double b, double h, double A_s1, double A_s2, double c_cntr1, double c_cntr2, double A_s_prime1, double A_s_prime2, double c_cntr_prime1, double c_cntr_prime2, ConcreteMaterial concrete, IRebarMaterial rebar, ConfinementReinforcementType ConfinementReinforcementType) { CrossSectionRectangularShape Section = new CrossSectionRectangularShape(concrete, null, b, h); List <RebarPoint> LongitudinalBars = new List <RebarPoint>(); Rebar bottom1 = new Rebar(A_s1, rebar); RebarPoint pointBottom1 = new RebarPoint(bottom1, new RebarCoordinate() { X = 0, Y = -h / 2.0 + c_cntr1 }); LongitudinalBars.Add(pointBottom1); if (A_s2 != 0) { Rebar bottom2 = new Rebar(A_s2, rebar); RebarPoint pointBottom2 = new RebarPoint(bottom2, new RebarCoordinate() { X = 0, Y = -h / 2.0 + c_cntr2 }); LongitudinalBars.Add(pointBottom2); } if (A_s_prime1 != 0) { Rebar top1 = new Rebar(A_s_prime1, rebar); RebarPoint pointTop1 = new RebarPoint(top1, new RebarCoordinate() { X = 0, Y = h / 2.0 - c_cntr_prime1 }); LongitudinalBars.Add(pointTop1); } if (A_s_prime2 != 0) { Rebar top2 = new Rebar(A_s_prime2, rebar); RebarPoint pointTop2 = new RebarPoint(top2, new RebarCoordinate() { X = 0, Y = h / 2.0 - c_cntr_prime2 }); LongitudinalBars.Add(pointTop2); } CalcLog log = new CalcLog(); ConcreteSectionFlexure beam = new ConcreteSectionFlexure(Section, LongitudinalBars, log, ConfinementReinforcementType); return(beam); }
private static string GetSpacing(Rebar rebar) { Parameter layoutParam = rebar.get_Parameter(BuiltInParameter.REBAR_ELEM_LAYOUT_RULE); if (layoutParam.AsInteger() == 0) { return ""; } Parameter spacingParam = rebar.get_Parameter(BuiltInParameter.REBAR_ELEM_BAR_SPACING); ForgeTypeId unitType = spacingParam.GetUnitTypeId(); double spacing = spacingParam.AsDouble(); spacing = UnitUtils.ConvertFromInternalUnits(spacing, unitType); return "c" + spacing.ToString("0"); }
private void addHookInformation2Rebar( ArrayList data, Rebar rebar, int end ) { if( end != 0 && end != 1 ) return; ElementId hookId = rebar.GetHookTypeId( end ); if( hookId != null && hookId != ElementId.InvalidElementId ) { data.Add( new Snoop.Data.CategorySeparator( "HookType at end: " + end.ToString() ) ); data.Add( new Snoop.Data.ElementId( "Hook Type", hookId, rebar.Document ) ); data.Add( new Snoop.Data.String( "HookOrientation", rebar.GetHookOrientation( end ).ToString() ) ); } }
public CompressionLapSplice(IConcreteMaterial Concrete, Rebar Rebar, ICalcLog log): base(log) { this.Concrete = Concrete; this.Rebar = Rebar; }
/// <summary> /// Set Solid In View /// </summary> /// <param name="rebar">Single Rebar</param> /// <param name="view">3D View</param> /// <param name="solid">Solid</param> public static void SetSolidInView(Rebar rebar, Revit.Elements.Views.View3D view, bool solid) { Autodesk.Revit.DB.Document document = DocumentManager.Instance.CurrentDBDocument; TransactionManager.Instance.EnsureInTransaction(document); Autodesk.Revit.DB.Structure.Rebar rebarElement = (Autodesk.Revit.DB.Structure.Rebar)rebar.InternalElement; Autodesk.Revit.DB.View3D viewElement = (Autodesk.Revit.DB.View3D)view.InternalElement; rebarElement.SetSolidInView(viewElement, solid); TransactionManager.Instance.TransactionTaskDone(); }
private void Stream( ArrayList data, Rebar rebar ) { data.Add( new Snoop.Data.ClassSeparator( typeof( Rebar ) ) ); data.Add( new Snoop.Data.ElementId( "Bar type", rebar.GetTypeId(), rebar.Document ) ); data.Add( new Snoop.Data.ElementId( "Rebar shape", rebar.RebarShapeId, rebar.Document ) ); data.Add( new Snoop.Data.ElementId( "Host", rebar.GetHostId(), rebar.Document ) ); data.Add( new Snoop.Data.Object( "Distribution path", rebar.GetDistributionPath() ) ); data.Add( new Snoop.Data.Enumerable( "GetCenterlineCurves(false, false, false)", rebar.GetCenterlineCurves( false, false, false, MultiplanarOption.IncludeOnlyPlanarCurves, 0 ) ) ); data.Add( new Snoop.Data.String( "LayoutRule", rebar.LayoutRule.ToString() ) ); if( rebar.LayoutRule != RebarLayoutRule.Single ) { data.Add( new Snoop.Data.Double( "Distribution path length", rebar.ArrayLength ) ); data.Add( new Snoop.Data.Int( "Quantity", rebar.Quantity ) ); data.Add( new Snoop.Data.Int( "NumberOfBarPositions", rebar.NumberOfBarPositions ) ); data.Add( new Snoop.Data.Double( "MaxSpacing", rebar.MaxSpacing ) ); data.Add( new Snoop.Data.Bool( "BarsOnNormalSide", rebar.BarsOnNormalSide ) ); } data.Add( new Snoop.Data.String( "ScheduleMark", rebar.ScheduleMark ) ); data.Add( new Snoop.Data.Double( "Volume", rebar.Volume ) ); data.Add( new Snoop.Data.Double( "TotalLength", rebar.TotalLength ) ); data.Add( new Snoop.Data.Object( "Normal", rebar.Normal ) ); //TF data.Add( new Snoop.Data.Object( "ConstraintsManager", rebar.GetRebarConstraintsManager() ) ); //TFEND // Bending data data.Add( new Snoop.Data.Object( "Bending Data", rebar.GetBendData() ) ); // Hook information addHookInformation2Rebar( data, rebar, 0 ); addHookInformation2Rebar( data, rebar, 1 ); }
/// <summary> /// Exports a Rebar to IFC ReinforcingMesh. /// </summary> /// <param name="exporterIFC"> /// The ExporterIFC object. /// </param> /// <param name="element"> /// The element to be exported. /// </param> /// <param name="productWrapper"> /// The IFCProductWrapper. /// </param> public static void ExportRebar(ExporterIFC exporterIFC, Rebar element, Autodesk.Revit.DB.View filterView, IFCProductWrapper productWrapper) { IFCFile file = exporterIFC.GetFile(); using (IFCTransaction transaction = new IFCTransaction(file)) { using (IFCPlacementSetter setter = IFCPlacementSetter.Create(exporterIFC, element)) { GeometryElement rebarGeometry = ExporterIFCUtils.GetRebarGeometry(element, filterView); // only options are: Not Export, BuildingElementProxy, or ReinforcingBar/Mesh, depending on layout. // Not Export is handled previously, and ReinforcingBar vs Mesh will be determined below. string ifcEnumType; IFCExportType exportType = ExporterUtil.GetExportType(exporterIFC, element, out ifcEnumType); if (exportType == IFCExportType.ExportBuildingElementProxy) { if (rebarGeometry != null) { ProxyElementExporter.ExportBuildingElementProxy(exporterIFC, element, rebarGeometry, productWrapper); transaction.Commit(); } return; } IFCAnyHandle prodRep = null; using (IFCExtrusionCreationData extrusionCreationData = new IFCExtrusionCreationData()) { extrusionCreationData.SetLocalPlacement(setter.GetPlacement()); if (rebarGeometry != null) { ElementId categoryId = CategoryUtil.GetSafeCategoryId(element); BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true); prodRep = BodyExporter.ExportBody(element.Document.Application, exporterIFC, element, categoryId, rebarGeometry, bodyExporterOptions, extrusionCreationData).RepresentationHnd; if (IFCAnyHandleUtil.IsNullOrHasNoValue(prodRep)) extrusionCreationData.ClearOpenings(); } double scale = exporterIFC.LinearScale; double barLength = element.TotalLength * scale; if (MathUtil.IsAlmostZero(barLength)) return; int quantity = element.Quantity; if (quantity < 1) return; ElementId typeId = element.GetTypeId(); RebarBarType elementType = element.Document.GetElement(element.GetTypeId()) as RebarBarType; double diameter = elementType == null ? 1.0 / 12.0 : elementType.BarDiameter; double longitudinalBarNominalDiameter = diameter * scale; double longitudinalBarCrossSectionArea = (element.Volume * scale * scale * scale) / barLength; string steelGradeOpt = null; IFCAnyHandle elemHnd = null; string rebarGUID = ExporterIFCUtils.CreateGUID(element); string origRebarName = exporterIFC.GetName(); string rebarName = NamingUtil.GetNameOverride(element, origRebarName); string rebarDescription = NamingUtil.GetDescriptionOverride(element, null); string rebarObjectType = NamingUtil.GetObjectTypeOverride(element, NamingUtil.CreateIFCObjectName(exporterIFC, element)); string rebarElemId = NamingUtil.CreateIFCElementId(element); if (element.LayoutRule == RebarLayoutRule.Single || (quantity == 1)) { IFCReinforcingBarRole role = IFCReinforcingBarRole.NotDefined; elemHnd = IFCInstanceExporter.CreateReinforcingBar(file, rebarGUID, exporterIFC.GetOwnerHistoryHandle(), rebarName, rebarDescription, rebarObjectType, extrusionCreationData.GetLocalPlacement(), prodRep, rebarElemId, steelGradeOpt, longitudinalBarNominalDiameter, longitudinalBarCrossSectionArea, barLength, role, null); } else { double meshLength; double longitudinalBarSpacing; double val = element.ArrayLength * scale; if (element.LayoutRule == RebarLayoutRule.NumberWithSpacing) { longitudinalBarSpacing = val; meshLength = val * (quantity - 1); } else { meshLength = val; longitudinalBarSpacing = val / (quantity - 1); } double meshWidth = diameter * scale; // array is in one direction only. double transverseBarNominalDiameter = longitudinalBarNominalDiameter; double transverseBarCrossSectionArea = longitudinalBarCrossSectionArea; double transverseBarSpacing = longitudinalBarSpacing; elemHnd = IFCInstanceExporter.CreateReinforcingMesh(file, rebarGUID, exporterIFC.GetOwnerHistoryHandle(), rebarName, rebarDescription, rebarObjectType, extrusionCreationData.GetLocalPlacement(), prodRep, rebarElemId, steelGradeOpt, meshLength, meshWidth, longitudinalBarNominalDiameter, transverseBarNominalDiameter, longitudinalBarCrossSectionArea, transverseBarCrossSectionArea, longitudinalBarSpacing, transverseBarSpacing); } productWrapper.AddElement(elemHnd, setter.GetLevelInfo(), extrusionCreationData, true); PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper); } } transaction.Commit(); } }
private void Stream( ArrayList data, Rebar rebar ) { data.Add( new Snoop.Data.ClassSeparator( typeof( Rebar ) ) ); data.Add( new Snoop.Data.ElementId( "Bar type", rebar.GetTypeId(), rebar.Document ) ); data.Add( new Snoop.Data.ElementId( "Rebar shape", rebar.RebarShapeId, rebar.Document ) ); data.Add( new Snoop.Data.ElementId( "Host", rebar.GetHostId(), rebar.Document ) ); data.Add( new Snoop.Data.Object( "Distribution path", rebar.GetDistributionPath() ) ); data.Add( new Snoop.Data.Enumerable( "GetCenterlineCurves(false, false, false)", rebar.GetCenterlineCurves( false, false, false ) ) ); data.Add( new Snoop.Data.String( "LayoutRule", rebar.LayoutRule.ToString() ) ); if( rebar.LayoutRule != RebarLayoutRule.Single ) { data.Add( new Snoop.Data.Double( "Distribution path length", rebar.ArrayLength ) ); data.Add( new Snoop.Data.Int( "Quantity", rebar.Quantity ) ); data.Add( new Snoop.Data.Int( "NumberOfBarPositions", rebar.NumberOfBarPositions ) ); data.Add( new Snoop.Data.Double( "MaxSpacing", rebar.MaxSpacing ) ); } //TF data.Add( new Snoop.Data.Object( "ConstraintsManager", rebar.GetRebarConstraintsManager() ) ); //TFEND }
/// <summary> /// The helper function to changed rebar number and spacing properties /// </summary> /// <param name="bar">The rebar instance which need to modify</param> /// <param name="number">The rebar number want to set</param> /// <param name="spacing">The spacing want to set</param> protected static void SetRebarSpaceAndNumber(Rebar bar, int number, double spacing) { // Asset the parameter is valid if (null == bar || 2 > number || 0 > spacing) { return; } // Change the rebar number and spacing properties bar.SetLayoutAsNumberWithSpacing(number, spacing, true, true, true); }
/// <summary> /// Present the main dialog for user to prepare the parameters for Rebar creation, /// and after that if user click the OK button, a new Rebar will be created. /// </summary> public void Execute() { using (NewRebarForm form = new NewRebarForm(m_rvtUIDoc.Document)) { if (DialogResult.OK == form.ShowDialog()) { RebarBarType barType = form.RebarBarType; RebarShape barShape = form.RebarShape; List<Autodesk.Revit.DB.XYZ> profilePoints = m_geometryData.ProfilePoints; Autodesk.Revit.DB.XYZ origin = profilePoints[0]; Autodesk.Revit.DB.XYZ yVec = profilePoints[1] - origin; Autodesk.Revit.DB.XYZ xVec = profilePoints[3] - origin; m_createdRebar = Rebar.CreateFromRebarShape(m_rvtUIDoc.Document, barShape, barType, m_rebarHost, origin, xVec, yVec); LayoutRebar(); } } }
public void getSubElement_geo() { UIDocument uiDoc = this.ActiveUIDocument; Document doc = uiDoc.Document; View myView = doc.ActiveView; Reference myRef = uiDoc.Selection.PickObject(ObjectType.Element, "Pick a rebar..."); Rebar myRebar = doc.GetElement(myRef) as Rebar; TaskDialog.Show("abc", "Has: " + myRebar.NumberOfBarPositions.ToString()); ReferenceArray myRefAr = new ReferenceArray(); TaskDialog.Show("abc", myRebar.IsRebarInSection(myView).ToString()); // // setCurrentViewAsWorkPlan(); // // XYZ myDimPoint_1 = uiDoc.Selection.PickPoint("Pick Point To Place Dimension...."); // XYZ myDimPoint_2 = new XYZ(myDimPoint_1.X+5, myDimPoint_1.Y, myDimPoint_1.Z); // Line dimLine = Line.CreateBound(myDimPoint_1, myDimPoint_2); // // // using(Transaction trans = new Transaction(doc, "Create linear Dimension")) // { // trans.Start(); // Dimension myDim = doc.Create.NewDimension(doc.ActiveView, dimLine, myRefAr); // trans.Commit(); // } }