public static ConstantFramingProperty ConstantFramingProperty(ISectionProperty sectionProperty, double orientationAngle, string name = "")
        {
            IProfile profile = null;

            if (sectionProperty is IGeometricalSection)
            {
                profile = (sectionProperty as IGeometricalSection).SectionProfile;
            }
            else
            {
                Reflection.Compute.RecordWarning("Was not able to extract any section profile.");
            }


            BH.oM.Physical.Materials.Material material = null;

            if (sectionProperty.Material != null)
            {
                string matName = sectionProperty.Material.Name ?? "";
                material = Physical.Create.Material(matName, new List <oM.Physical.Materials.IMaterialProperties> {
                    sectionProperty.Material
                });
            }
            else
            {
                Engine.Reflection.Compute.RecordWarning("Material from sectiion property of the bar is null.");
            }

            name = string.IsNullOrEmpty(name) ? sectionProperty.Name : name;

            return(Physical.Create.ConstantFramingProperty(profile, material, orientationAngle, name));
        }
Пример #2
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private List <ISectionProperty> ReadSectionProperties(List <string> ids = null)
        {
            object[] lusasSections = d_LusasData.getAttributes("Geometric");
            List <ISectionProperty> sectionProperties = new List <ISectionProperty>();

            for (int i = 0; i < lusasSections.Count(); i++)
            {
                IFGeometric lusasSection = (IFGeometric)lusasSections[i];

                switch (lusasSection.getAttributeType())
                {
                case "Surface Geometric":
                    break;

                default:
                    ISectionProperty sectionProperty = Adapters.Lusas.Convert.ToSection(lusasSection);
                    if (sectionProperty != null)
                    {
                        sectionProperties.Add(sectionProperty);
                    }
                    break;
                }
            }
            return(sectionProperties);
        }
Пример #3
0
        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);

            }
        }
Пример #4
0
        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);
        }
Пример #5
0
        /***************************************************/

        private bool CreateObject(ISectionProperty bhSection)
        {
            bool success = true;

            Helper.SetSectionProperty(m_model, bhSection);//TODO: this is only halfway done - should be moved away from engine to adapter as much as possible
            return(success);
        }
Пример #6
0
        public static ISectionProperty ApplyModifiers(this ISectionProperty prop, double area = 1, double iy = 1, double iz = 1, double j = 1, double asy = 1, double asz = 1)
        {
            if (prop.IsNull())
            {
                return(null);
            }

            ISectionProperty clone = prop.ShallowClone();

            double[] modifiers = new double[] { area, iy, iz, j, asy, asz };

            SectionModifier modifier = new SectionModifier
            {
                Area = area,
                Iy   = iy,
                Iz   = iz,
                J    = j,
                Asy  = asy,
                Asz  = asz
            };

            clone.Fragments = new oM.Base.FragmentSet(clone.Fragments);
            clone.Fragments.AddOrReplace(modifier);

            return(clone);
        }
Пример #7
0
        private ISectionProperty GetTaperedSectionProperty(ISectionProperty startSectionProperty, ISectionProperty endSectionProperty)
        {
            if (startSectionProperty.Material.Name != endSectionProperty.Material.Name)
            {
                Engine.Base.Compute.RecordWarning("Tapered section mixes materials. Only material from start of section is used");
            }

            oM.Spatial.ShapeProfiles.IProfile taperProfile = null;

            if (startSectionProperty.Material.GetType() == typeof(Steel))
            {
                SteelSection startSection = startSectionProperty as SteelSection;
                SteelSection endSection   = endSectionProperty as SteelSection;
                taperProfile      = BH.Engine.Spatial.Create.TaperedProfile(startSection.SectionProfile, endSection.SectionProfile);
                taperProfile.Name = "TaperedProfile-" + startSection.Name + "-To-" + endSection.Name;
            }

            if (startSectionProperty.Material.GetType() == typeof(Concrete))
            {
                ConcreteSection startSection = startSectionProperty as ConcreteSection;
                ConcreteSection endSection   = endSectionProperty as ConcreteSection;
                taperProfile      = BH.Engine.Spatial.Create.TaperedProfile(startSection.SectionProfile, endSection.SectionProfile);
                taperProfile.Name = "TaperedProfile-" + startSection.Name + "-To-" + endSection.Name;
            }

            if (startSectionProperty.Material.GetType() == typeof(Timber))
            {
                TimberSection startSection = startSectionProperty as TimberSection;
                TimberSection endSection   = endSectionProperty as TimberSection;
                taperProfile      = BH.Engine.Spatial.Create.TaperedProfile(startSection.SectionProfile, endSection.SectionProfile);
                taperProfile.Name = "TaperedProfile-" + startSection.Name + "-To-" + endSection.Name;
            }

            return(BH.Engine.Structure.Create.SectionPropertyFromProfile(taperProfile, startSectionProperty.Material));
        }
Пример #8
0
        /***************************************************/
        /******     SectionProperty                  *******/
        /***************************************************/

        private bool CreateObject(ISectionProperty bhSection)
        {
            string propertyName = bhSection.DescriptionOrName();

            SetAdapterId(bhSection, propertyName);

            if (!LoadFromDatabase(bhSection))
            {
                CheckPropertyWarning(bhSection, x => x.Material); //Check the material

                SetSection(bhSection as dynamic);
            }

            SectionModifier modifier = bhSection.FindFragment <SectionModifier>();

            if (modifier != null)
            {
                double[] etabsMods = new double[8];

                etabsMods[0] = modifier.Area;   //Area
                etabsMods[1] = modifier.Asz;    //Major axis shear
                etabsMods[2] = modifier.Asy;    //Minor axis shear
                etabsMods[3] = modifier.J;      //Torsion
                etabsMods[4] = modifier.Iz;     //Minor bending
                etabsMods[5] = modifier.Iy;     //Major bending
                etabsMods[6] = 1;               //Mass, not currently implemented
                etabsMods[7] = 1;               //Weight, not currently implemented

                m_model.PropFrame.SetModifiers(propertyName, ref etabsMods);
            }

            return(true);
        }
Пример #9
0
        /***************************************************/

        private void SetGeneral(ISectionProperty section)
        {
            m_model.PropFrame.SetGeneral(section.DescriptionOrName(), section.Material?.DescriptionOrName() ?? "", section.Vz + section.Vpz, section.Vy + section.Vpy,
                                         section.Area, section.Asz, section.Asy, section.J,
                                         section.Iz, section.Iy,     // I22, I33
                                         section.Welz, section.Wely, // S22, S33
                                         section.Wplz, section.Wply, // Z22, Z33
                                         section.Rgz, section.Rgy);  // R22, R33
        }
Пример #10
0
        public static string IDescription(this ISectionProperty section)
        {
            if (section == null)
            {
                return("null section");
            }

            return(Description(section as dynamic));
        }
Пример #11
0
        public static bool IsNull(this ISectionProperty sectionProperty, string msg = "", [CallerMemberName] string methodName = "Method")
        {
            if (sectionProperty == null)
            {
                ErrorMessage(methodName, "SectionProperty", msg);
                return(true);
            }

            return(false);
        }
Пример #12
0
        /***************************************************/

        public static ISectionProperty ApplyModifiers(this ISectionProperty prop, double area = 1, double iy = 1, double iz = 1, double j = 1, double asy = 1, double asz = 1)
        {
            ISectionProperty clone = prop.GetShallowClone() as ISectionProperty;

            double[] modifiers = new double[] { area, iy, iz, j, asy, asz };

            clone.CustomData["Modifiers"] = modifiers;

            return(clone);
        }
Пример #13
0
        /***************************************************/

        public static Bar ToBHoMObject(IHorizBrace ramHorizBrace, ILayoutHorizBrace ramLayoutHorizBrace, double dElevation)
        {
            string sectionName = ramHorizBrace.strSectionLabel;

            ISectionProperty sectionProperty = ToBHoMSection(ramHorizBrace);

            // Get the start and end pts of every brace
            double StartSupportX       = new double();
            double StartSupportY       = new double();
            double StartSupportZOffset = new double();
            double EndSupportX         = new double();
            double EndSupportY         = new double();
            double EndSupportZOffset   = new double();
            double StoryZ = dElevation;


            // Get coordinates from ILayout Brace
            ramLayoutHorizBrace.GetLayoutCoordinates(out StartSupportX, out StartSupportY, out StartSupportZOffset, out EndSupportX, out EndSupportY, out EndSupportZOffset);
            Node startNode = new Node {
                Position = new oM.Geometry.Point()
                {
                    X = StartSupportX.FromInch(), Y = StartSupportY.FromInch(), Z = StoryZ.FromInch() + StartSupportZOffset.FromInch()
                }
            };
            Node endNode = new Node {
                Position = new oM.Geometry.Point()
                {
                    X = EndSupportX.FromInch(), Y = EndSupportY.FromInch(), Z = StoryZ.FromInch() + EndSupportZOffset.FromInch()
                }
            };

            Bar bhomBar = new Bar {
                StartNode = startNode, EndNode = endNode, SectionProperty = sectionProperty, Name = sectionName
            };

            bhomBar.OrientationAngle = 0;

            // Unique RAM ID
            RAMId RAMId = new RAMId();

            RAMId.Id = ramLayoutHorizBrace.lUID;
            bhomBar.SetAdapterId(RAMId);

            //Add Frame Data fragment
            RAMFrameData ramFrameData = new RAMFrameData();

            ramFrameData.FrameNumber = ramLayoutHorizBrace.lLabel;
            ramFrameData.Material    = ramLayoutHorizBrace.eMaterial.ToString();
            bhomBar.Fragments.Add(ramFrameData);

            bhomBar.Tags.Add("HorizontalBrace");

            return(bhomBar);
        }
Пример #14
0
        public static double[] Modifiers(this ISectionProperty property)
        {
            SectionModifier modifier = property.FindFragment <SectionModifier>();

            if (modifier == null)
            {
                return(null);
            }

            return(new double[] { modifier.Area, modifier.Iy, modifier.Iz, modifier.J, modifier.Asy, modifier.Asz });
        }
Пример #15
0
        public static Bar Bar(Line line, ISectionProperty sectionProperty = null, Vector normal = null, BarRelease release = null, BarFEAType feaType = BarFEAType.Flexural, string name = "")
        {
            double orientationAngle = normal.OrientationAngleLinear(line);

            if (double.IsNaN(orientationAngle))
            {
                return(null);
            }

            return(Bar(line, sectionProperty, orientationAngle, release, feaType, name));
        }
Пример #16
0
 public static string DescriptionOrName(this ISectionProperty section)
 {
     if (string.IsNullOrWhiteSpace(section.Name))
     {
         return(IDescription(section));
     }
     else
     {
         return(section.Name);
     }
 }
Пример #17
0
        /***************************************************/

        public static double[] Modifiers(this ISectionProperty property)
        {
            object modifersObj;

            if (property.CustomData.TryGetValue("Modifiers", out modifersObj))
            {
                return(modifersObj as double[]);
            }

            return(null);
        }
Пример #18
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/
        public static bool InvalidSectionProperty(this ISectionProperty sectionProperty)
        {
            bool isInvalid = false;

            if (sectionProperty is ExplicitSection)
            {
                isInvalid = true;
                Base.Compute.RecordWarning("Unsupported SectionProperty (ExplicitSection) assigned to Bar.");
            }

            return(isInvalid);
        }
Пример #19
0
        public static ConstantFramingElementProperty ConstantFramingElementProperty(ISectionProperty sectionProperty, double orientationAngle, string name = "")
        {
            //If no name is provided, use the name of the section proeprty
            if (string.IsNullOrWhiteSpace(name) && !string.IsNullOrWhiteSpace(sectionProperty.Name))
            {
                name = sectionProperty.Name;
            }

            return(new ConstantFramingElementProperty {
                SectionProperty = sectionProperty, OrientationAngle = orientationAngle, Name = name
            });
        }
Пример #20
0
        /***************************************************/

        private static ISectionProperty ToSectionProperty(BHP.FramingProperties.ConstantFramingProperty property)
        {
            ISectionProperty prop = null;

            BHP.Materials.Material material = property.Material;

            IMaterialFragment fragment;

            if (material == null)
            {
                Reflection.Compute.RecordError("The FramingElement does not contain any material. An empty steel material has been used");
                fragment = new Steel();
            }
            else if (!material.IsValidStructural())
            {
                string matName = material.Name ?? "";
                Reflection.Compute.RecordWarning("The material with name " + matName + " is not a valid structural material as it does not contain exactly one structural material fragment. An empty steel material has been assumed");
                fragment = new Steel {
                    Name = matName
                };
            }
            else
            {
                fragment = material.StructuralMaterialFragment();
            }

            switch (fragment.IMaterialType())
            {
            case oM.Structure.MaterialFragments.MaterialType.Steel:
                prop = Create.SteelSectionFromProfile(property.Profile, fragment as Steel, property.Name);
                break;

            case oM.Structure.MaterialFragments.MaterialType.Concrete:
                prop = Create.ConcreteSectionFromProfile(property.Profile, fragment as Concrete, property.Name);
                break;

            case oM.Structure.MaterialFragments.MaterialType.Aluminium:
            case oM.Structure.MaterialFragments.MaterialType.Timber:
            case oM.Structure.MaterialFragments.MaterialType.Rebar:
            case oM.Structure.MaterialFragments.MaterialType.Tendon:
            case oM.Structure.MaterialFragments.MaterialType.Glass:
            case oM.Structure.MaterialFragments.MaterialType.Cable:
            case oM.Structure.MaterialFragments.MaterialType.Undefined:
            default:
                prop          = Create.SteelSectionFromProfile(property.Profile, null, property.Name);
                prop.Material = fragment;
                Reflection.Compute.RecordWarning("The BHoM does not currently support sections of material type " + fragment.IMaterialType() + ". A steel section has been created with the material applied to it");
                break;
            }

            return(prop);
        }
Пример #21
0
 public static Bar Bar(Line line, ISectionProperty sectionProperty = null, double orientationAngle = 0, BarRelease release = null, BarFEAType feaType = BarFEAType.Flexural, string name = "")
 {
     return(new Bar
     {
         Name = name,
         StartNode = (Node)line.Start,
         EndNode = (Node)line.End,
         SectionProperty = sectionProperty,
         Release = release == null?BarReleaseFixFix() : release,
                       FEAType = feaType,
                       OrientationAngle = orientationAngle
     });
 }
Пример #22
0
 public static Bar Bar(Node startNode, Node endNode, ISectionProperty property = null, double orientationAngle = 0, BarRelease release = null, BarFEAType feaType = BarFEAType.Flexural, string name = "")
 {
     return(new Bar
     {
         Name = name,
         StartNode = startNode,
         EndNode = endNode,
         SectionProperty = property,
         Release = release == null?BarReleaseFixFix() : release,
                       FEAType = feaType,
                       OrientationAngle = orientationAngle
     });
 }
Пример #23
0
        /***************************************************/

        private void SetGeneral(ISectionProperty bhomSection)
        {
            m_model.PropFrame.SetGeneral(bhomSection.DescriptionOrName(),
                                         bhomSection.Material?.DescriptionOrName() ?? "",
                                         bhomSection.CentreZ * 2,
                                         bhomSection.CentreY * 2,
                                         bhomSection.Area,
                                         bhomSection.Asy,
                                         bhomSection.Asz,
                                         bhomSection.J, bhomSection.Iy, bhomSection.Iz,
                                         bhomSection.Wply, bhomSection.Wplz,
                                         bhomSection.Wely, bhomSection.Wely,
                                         bhomSection.Rgy, bhomSection.Rgz);
        }
Пример #24
0
        public static Bar SetMaterial(this Bar bar, IMaterialFragment material)
        {
            Bar clone = bar.GetShallowClone() as Bar;

            if (bar.SectionProperty == null)
            {
                Engine.Reflection.Compute.RecordError("The section property parameter is null - material has not been assigned");
                return(clone);
            }
            ISectionProperty sectionClone = bar.SectionProperty.GetShallowClone() as ISectionProperty;

            sectionClone.Material = material;
            clone.SectionProperty = sectionClone;
            return(clone);
        }
Пример #25
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/
        public static bool InvalidSectionProfile(this ISectionProperty sectionProfile)
        {
            bool isInvalid = false;

            if (sectionProfile is GeneralisedFabricatedBoxProfile ||
                sectionProfile is GeneralisedTSectionProfile ||
                sectionProfile is FreeFormProfile ||
                sectionProfile is KiteProfile)
            {
                isInvalid = true;
            }
            Base.Compute.RecordWarning("Unsupported SectionProfile (GeneralisedFabricatedBoxProfile, GeneralisedTSectionProfile, FreeformProfile or KiteProfile) assigned to Bar SectionProperty.");

            return(isInvalid);
        }
Пример #26
0
        /***************************************************/

        private void SetModifiers(ISectionProperty bhomSection)
        {
            string propertyName = bhomSection.DescriptionOrName();

            SectionModifier modifier = bhomSection.FindFragment <SectionModifier>();

            if (modifier != null)
            {
                double[] sap2000Mods = SectionModifierToCSI(modifier);

                if (m_model.PropFrame.SetModifiers(propertyName, ref sap2000Mods) != 0)
                {
                    Engine.Base.Compute.RecordError($"Could not add user specified section modifiers for {bhomSection.DescriptionOrName()}.");
                }
            }
        }
Пример #27
0
        /***************************************************/
        /**** Private Methods                            ****/
        /***************************************************/

        private bool CreateObject(ISectionProperty bhomSection)
        {
            string propName = bhomSection.DescriptionOrName();

            if (bhomSection.Material == null)
            {
                Engine.Base.Compute.RecordWarning($"Section {propName} had no material defined. Using a default material.");
            }

            SetSection(bhomSection as dynamic);

            SetAdapterId(bhomSection, bhomSection.DescriptionOrName());

            SetModifiers(bhomSection);

            return(true);
        }
Пример #28
0
        public static bool HasModifiers(this ISectionProperty property)
        {
            double[] modifiers = property.Modifiers();

            if (modifiers == null)
            {
                return(false);
            }

            foreach (double modifier in modifiers)
            {
                if (modifier != 1)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #29
0
        /***************************************************/

        public static Bar ToBHoMObject(this IVerticalBrace ramVerticalBrace)
        {
            // Get the column name
            string sectionName = ramVerticalBrace.strSectionLabel;

            ISectionProperty sectionProperty = ToBHoMSection(ramVerticalBrace);

            // Get the start and end pts of every column
            SCoordinate startPt = new SCoordinate();
            SCoordinate endPt   = new SCoordinate();

            ramVerticalBrace.GetEndCoordinates(ref startPt, ref endPt);
            Node startNode = new Node {
                Position = startPt.PointFromRAM()
            };
            Node endNode = new Node {
                Position = endPt.PointFromRAM()
            };


            Bar bhomBar = new Bar {
                StartNode = startNode, EndNode = endNode, SectionProperty = sectionProperty, Name = sectionName
            };

            bhomBar.OrientationAngle = 0;

            // Unique RAM ID
            RAMId RAMId = new RAMId();

            RAMId.Id = ramVerticalBrace.lUID;
            bhomBar.SetAdapterId(RAMId);

            //Add Frame Data fragment
            RAMFrameData ramFrameData = new RAMFrameData();

            ramFrameData.FrameNumber = ramVerticalBrace.lLabel;
            ramFrameData.FrameType   = ramVerticalBrace.eSeismicFrameType.ToString();
            ramFrameData.Material    = ramVerticalBrace.eMaterial.ToString();
            bhomBar.Fragments.Add(ramFrameData);

            bhomBar.Tags.Add("VerticalBrace");

            return(bhomBar);
        }
Пример #30
0
        /***************************************************/

        public static Bar Bar(Line line, ISectionProperty property = null, Vector normal = null, BarRelease release = null, BarFEAType feaType = BarFEAType.Flexural, string name = "")
        {
            double orientationAngle;

            if (normal == null)
            {
                orientationAngle = 0;
            }
            else
            {
                normal = normal.Normalise();
                Vector tan = (line.End - line.Start).Normalise();

                double dot = normal.DotProduct(tan);

                if (Math.Abs(1 - dot) < oM.Geometry.Tolerance.Angle)
                {
                    Reflection.Compute.RecordError("The normal is parallell to the centreline of the bar");
                    return(null);
                }
                else if (Math.Abs(dot) > oM.Geometry.Tolerance.Angle)
                {
                    Reflection.Compute.RecordWarning("Normal not othogonal to the centreline and will get projected");
                }

                Vector reference;

                if (!line.IsVertical())
                {
                    reference = Vector.ZAxis;
                }
                else
                {
                    reference = tan.CrossProduct(Vector.YAxis);
                }

                orientationAngle = reference.Angle(normal, new Plane {
                    Normal = tan
                });
            }


            return(Bar(Node(line.Start), Node(line.End), property, orientationAngle, release, feaType, name));
        }