public static BHPE.IFramingElement FramingElement(Bar bar, StructuralUsage1D structuralUsage = StructuralUsage1D.Beam) { ISectionProperty prop = bar.SectionProperty; BHPP.ConstantFramingProperty framingProp = null; if (prop == null) Reflection.Compute.RecordWarning("The bar does not contain a sectionProperty. Can not extract profile or material"); else framingProp = Create.ConstantFramingProperty(bar.SectionProperty, bar.OrientationAngle); Line location = bar.Centreline(); string name = bar.Name ?? ""; switch (structuralUsage) { case StructuralUsage1D.Column: return Physical.Create.Column(location, framingProp, name); case StructuralUsage1D.Brace: return Physical.Create.Bracing(location, framingProp, name); case StructuralUsage1D.Cable: return Physical.Create.Cable(location, framingProp, name); case StructuralUsage1D.Pile: return Physical.Create.Pile(location, framingProp, name); default: case StructuralUsage1D.Undefined: case StructuralUsage1D.Beam: return Physical.Create.Beam(location, framingProp, name); } }
public static BHPE.IFramingElement FramingElement(Bar bar, StructuralUsage1D structuralUsage = StructuralUsage1D.Beam) { if (bar.IsNull()) { return(null); } ISectionProperty prop = bar.SectionProperty; BHPP.ConstantFramingProperty framingProp = null; if (prop == null) { Reflection.Compute.RecordWarning("The bar does not contain a sectionProperty. Can not extract profile or material"); } else { framingProp = Create.ConstantFramingProperty(bar.SectionProperty, bar.OrientationAngle); } Line location = bar.Centreline(); string name = bar.Name ?? ""; BHPE.IFramingElement framingElement; switch (structuralUsage) { case StructuralUsage1D.Column: framingElement = Physical.Create.Column(location, framingProp, name); break; case StructuralUsage1D.Brace: framingElement = Physical.Create.Bracing(location, framingProp, name); break; case StructuralUsage1D.Cable: framingElement = Physical.Create.Cable(location, framingProp, name); break; case StructuralUsage1D.Pile: framingElement = Physical.Create.Pile(location, framingProp, name); break; default: case StructuralUsage1D.Undefined: case StructuralUsage1D.Beam: framingElement = Physical.Create.Beam(location, framingProp, name); break; } List <IReinforcingBar> reinforcement = bar.ReinforcingBars(); if (reinforcement.Count != 0) { framingElement.Fragments.Add(new ReinforcementFragment { ReinforcingBars = reinforcement }); } return(framingElement); }
public static FramingElement ToFramingElement(this Bar bar, StructuralUsage1D usage = StructuralUsage1D.Beam) { return(new FramingElement { LocationCurve = bar.Centreline(), Name = bar.Name, Property = Create.ConstantFramingElementProperty(bar.SectionProperty, bar.OrientationAngle, bar.SectionProperty.Name), StructuralUsage = usage }); }
public static List <ICurve> Visualize(this GravityLoad gravityLoad, double scaleFactor = 1.0, bool displayForces = true, bool displayMoments = true, bool asResultants = true) { if (gravityLoad.IsNull()) { return(null); } List <ICurve> arrows = new List <ICurve>(); Vector gravityDir = gravityLoad.GravityDirection * scaleFactor * 9.80665; int barDivisions = 5; foreach (BH.oM.Base.BHoMObject obj in gravityLoad.Objects.Elements) { if (obj is Bar) { Bar bar = obj as Bar; if (bar.SectionProperty == null || bar.SectionProperty.Material == null) { Reflection.Compute.RecordWarning("Bar needs a valid sectionproperty and material to display gravity loading"); continue; } Vector loadVector = bar.SectionProperty.IMassPerMetre() * gravityDir; List <Point> pts = DistributedPoints(bar, barDivisions); if (displayForces) { arrows.AddRange(ConnectedArrows(new List <ICurve> { bar.Centreline() }, loadVector, true, null, 1, true)); } } else if (obj is IAreaElement) { IAreaElement element = obj as IAreaElement; Vector loadVector = element.Property.IMassPerArea() * gravityDir; if (displayForces) { arrows.AddRange(ConnectedArrows(element.IEdges(), loadVector, true)); } } else { Reflection.Compute.RecordWarning("Display for gravity loads only implemented for Bars and IAreaElements. No area elements will be displayed"); } } return(arrows); }
public static Bar OrientTowards(this Bar bar, Point orientationPoint) { if (bar.IsNull() || orientationPoint.IsNull()) { return(null); } Point centre = bar.Centreline().ClosestPoint(orientationPoint); Vector normal = (orientationPoint - centre).Normalise(); return(bar.SetNormal(normal)); }
public static Bar SetNormal(this Bar bar, Vector normal) { if (bar.IsNull() || normal.IsNull()) { return(null); } double orientationAngle = normal.OrientationAngleLinear(bar.Centreline()); //Could not calculate the orientation angle. Return the original bar if (double.IsNaN(orientationAngle)) { return(bar); } Bar clone = bar.ShallowClone(); clone.OrientationAngle = orientationAngle; return(clone); }
public static IGeometry GeometricalRepresentation(this Bar bar, RepresentationOptions reprOptions = null) { if (bar == null) { BH.Engine.Base.Compute.RecordError("Cannot compute the geometrical representation of a null bar."); return(null); } reprOptions = reprOptions ?? new RepresentationOptions(); if (!reprOptions.Detailed1DElements) { return(bar.Centreline()); //returns the piped centreline. } else { // Gets the BH.oM.Geometry.Extrusion out of the Bar. If the profile is made of two curves (e.g. I section), selects only the outermost. Extrusion barOutermostExtrusion = bar.Extrude(false).Cast <Extrusion>().OrderBy(extr => extr.Curve.IArea()).First(); barOutermostExtrusion.Capped = reprOptions.Cap1DElements; return(barOutermostExtrusion); } }
/***************************************************/ public static Line Geometry(this Bar bar) { return(bar.Centreline()); }
public static Vector Normal(this Bar bar) { return(bar.Centreline().ElementNormal(bar.OrientationAngle)); }
public static bool IsVertical(this Bar bar) { return(Engine.Geometry.Query.IsVertical(bar.Centreline())); }