public static IGeometricalSection SectionPropertyFromProfile(IProfile profile, IMaterialFragment material = null, string name = "")
        {
            if (profile.IsNull())
            {
                return(null);
            }

            MaterialType materialType = material == null ? MaterialType.Undefined : material.IMaterialType();

            switch (materialType)
            {
            case MaterialType.Steel:
                return(SteelSectionFromProfile(profile, material as Steel, name));

            case MaterialType.Concrete:
                return(ConcreteSectionFromProfile(profile, material as Concrete, name));

            case MaterialType.Aluminium:
                return(AluminiumSectionFromProfile(profile, material as Aluminium, name));

            case MaterialType.Timber:
                return(TimberSectionFromProfile(profile, material as Timber, name));

            case MaterialType.Rebar:
            case MaterialType.Tendon:
            case MaterialType.Glass:
            case MaterialType.Cable:
            case MaterialType.Undefined:
            default:
                Reflection.Compute.RecordWarning("The BHoM does not currently explicitly support sections of material type " + materialType + ". A generic section has been created with the material applied to it");
                return(GenericSectionFromProfile(profile, material, name));
            }
        }
Esempio n. 2
0
        /***************************************************/

        public static EMATERIALTYPES ToRAM(this IMaterialFragment material)
        {
            EMATERIALTYPES Material = new EMATERIALTYPES();

            if (material.IMaterialType() == MaterialType.Concrete)
            {
                Material = EMATERIALTYPES.EConcreteMat;
            }
            else if (material.IMaterialType() == MaterialType.Steel)
            {
                Material = EMATERIALTYPES.ESteelMat;
            }
            else
            {
                Material = EMATERIALTYPES.ESteelMat;
            }
            return(Material);
        }
Esempio n. 3
0
        /***************************************************/
        /***    Create Methods                           ***/
        /***************************************************/

        private bool CreateObject(IMaterialFragment material)
        {
            bool     success = true;
            eMatType matType = eMatType.NoDesign;
            int      colour  = 0;
            string   guid    = null;
            string   notes   = "";
            string   name    = "";

            if (m_model.PropMaterial.GetMaterial(material.DescriptionOrName(), ref matType, ref colour, ref notes, ref guid) != 0)
            {
                m_model.PropMaterial.AddMaterial(ref name, MaterialTypeToCSI(material.IMaterialType()), "", "", "");
                m_model.PropMaterial.ChangeName(name, material.DescriptionOrName());

                success &= SetObject(material);
            }
            if (!success)
            {
                Engine.Base.Compute.RecordWarning($"Failed to assign material: {material.DescriptionOrName()}, ETABS may have overwritten some properties with default values");
            }
            return(success);
        }
Esempio n. 4
0
        private bool SetObject(IMaterialFragment material)
        {
            bool   success = true;
            string bhName  = material.DescriptionOrName();

            if (material is IIsotropic)
            {
                IIsotropic isotropic = material as IIsotropic;
                if (m_model.PropMaterial.SetMPIsotropic(bhName, isotropic.YoungsModulus, isotropic.PoissonsRatio, isotropic.ThermalExpansionCoeff) != 0)
                {
                    CreatePropertyWarning("Isotropy", "Material", bhName);
                }
            }
            else if (material is IOrthotropic)
            {
                IOrthotropic orthoTropic = material as IOrthotropic;
                double[]     e           = orthoTropic.YoungsModulus.ToDoubleArray();
                double[]     v           = orthoTropic.PoissonsRatio.ToDoubleArray();
                double[]     a           = orthoTropic.ThermalExpansionCoeff.ToDoubleArray();
                double[]     g           = orthoTropic.ShearModulus.ToDoubleArray();
                if (m_model.PropMaterial.SetMPOrthotropic(bhName, ref e, ref v, ref a, ref g) != 0)
                {
                    CreatePropertyWarning("Orthotropy", "Material", bhName);
                }
            }

            // Set Material Strengths
            eMatType matType = MaterialTypeToCSI(material.IMaterialType());

            switch (matType)
            {
            case eMatType.Aluminum:
                Engine.Base.Compute.RecordWarning("BHoM material aluminum does not have SAP2000 material parameters yet.");
                break;

            case eMatType.Steel:
                // try/catch for casting to steel?
                Steel steel = material as Steel;
                if (m_model.PropMaterial.SetOSteel_1(bhName, steel.YieldStress, steel.UltimateStress, steel.YieldStress, steel.UltimateStress, 0, 0, 0, 0, 0, 0, 0) != 0)
                {
                    CreatePropertyWarning("YieldStress", "Material", bhName);
                    CreatePropertyWarning("UltimateStress", "Material", bhName);
                }
                break;

            case eMatType.Concrete:
                Concrete concrete = material as Concrete;
                // name as NW/LW?
                if (m_model.PropMaterial.SetOConcrete_2(bhName, concrete.CylinderStrength, concrete.CylinderStrength, false, 0, 0, 0, 0, 0, 0) != 0)
                {
                    CreatePropertyWarning("ConcreteStrength", "Material", bhName);
                }
                break;

            case eMatType.Rebar:
                Steel reinf = material as Steel;
                if (m_model.PropMaterial.SetORebar_1(bhName, reinf.YieldStress, reinf.UltimateStress, reinf.YieldStress, reinf.UltimateStress, 0, 0, 0, 0, 0, false) != 0)
                {
                    CreatePropertyWarning("YieldStress", "Material", bhName);
                    CreatePropertyWarning("UltimateStress", "Material", bhName);
                }
                break;

            case eMatType.Tendon:
                Steel tendon = material as Steel;
                if (m_model.PropMaterial.SetOTendon_1(bhName, tendon.YieldStress, tendon.UltimateStress, 0, 0, 0) != 0)
                {
                    CreatePropertyWarning("YieldStress", "Material", bhName);
                    CreatePropertyWarning("UltimateStress", "Material", bhName);
                }
                break;

            default:
                Engine.Base.Compute.RecordWarning("BHoM material type not found, no additional design material parameters passed to SAP2000.");
                m_model.PropMaterial.SetONoDesign(bhName, 0, 0, 0);
                break;
            }


            if (m_model.PropMaterial.SetWeightAndMass(bhName, 2, material.Density) != 0)
            {
                CreatePropertyWarning("Density", "Material", bhName);
            }

            SetAdapterId(material, material.Name);

            return(success);
        }