コード例 #1
0
        /***************************************************/

        private static ISectionProperty ToSectionProperty(BHP.FramingProperties.ConstantFramingProperty property)
        {
            BHP.Materials.Material material = property.Material;

            IMaterialFragment fragment;

            if (material == null)
            {
                Reflection.Compute.RecordError("The FramingElement does not contain any material. An empty generic isotropic material has been used");
                fragment = new GenericIsotropicMaterial();
            }
            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 generic isotropic material has been assumed");
                fragment = new GenericIsotropicMaterial {
                    Name = matName
                };
            }
            else
            {
                fragment = material.StructuralMaterialFragment();
            }

            return(Create.SectionPropertyFromProfile(property.Profile, fragment, property.Name));
        }
コード例 #2
0
ファイル: Description.cs プロジェクト: BHoM/BHoM_Engine
        public static string Description(this GenericIsotropicMaterial material)
        {
            if (material == null)
            {
                return("null material");
            }

            return("Gen " + material.MaterialAnalyticalValues());
        }
コード例 #3
0
        /***************************************************/

        public static void CopyCharacteristics(this IMaterialFragment toMaterial, StructuralAsset fromAsset)
        {
            double density = fromAsset.Density.ToSI(UnitType.UT_MassDensity);

#if (REVIT2020 || REVIT2021)
#else
            double dampingRatio = fromAsset.DampingRatio;
#endif

            oM.Geometry.Vector youngsModulus         = BH.Engine.Geometry.Create.Vector(fromAsset.YoungModulus.X.ToSI(UnitType.UT_Stress), fromAsset.YoungModulus.Y.ToSI(UnitType.UT_Stress), fromAsset.YoungModulus.Z.ToSI(UnitType.UT_Stress));
            oM.Geometry.Vector thermalExpansionCoeff = BH.Engine.Geometry.Create.Vector(fromAsset.ThermalExpansionCoefficient.X.ToSI(UnitType.UT_ThermalExpansion), fromAsset.ThermalExpansionCoefficient.Y.ToSI(UnitType.UT_ThermalExpansion), fromAsset.ThermalExpansionCoefficient.Z.ToSI(UnitType.UT_ThermalExpansion));
            oM.Geometry.Vector poissonsRatio         = BH.Engine.Geometry.Create.Vector(fromAsset.PoissonRatio.X, fromAsset.PoissonRatio.Y, fromAsset.PoissonRatio.Z);
            oM.Geometry.Vector shearModulus          = BH.Engine.Geometry.Create.Vector(fromAsset.ShearModulus.X.ToSI(UnitType.UT_Stress), fromAsset.ShearModulus.Y.ToSI(UnitType.UT_Stress), fromAsset.ShearModulus.Z.ToSI(UnitType.UT_Stress));

            toMaterial.Density = density;
#if (REVIT2020 || REVIT2021)
#else
            toMaterial.DampingRatio = dampingRatio;
#endif

            if (toMaterial is Aluminium)
            {
                Aluminium material = toMaterial as Aluminium;
                material.YoungsModulus         = youngsModulus.X;
                material.ThermalExpansionCoeff = thermalExpansionCoeff.X;
                material.PoissonsRatio         = poissonsRatio.X;
            }
            else if (toMaterial is Concrete)
            {
                Concrete material = toMaterial as Concrete;
                material.YoungsModulus         = youngsModulus.X;
                material.ThermalExpansionCoeff = thermalExpansionCoeff.X;
                material.PoissonsRatio         = poissonsRatio.X;
            }
            else if (toMaterial is Steel)
            {
                Steel material = toMaterial as Steel;
                material.YoungsModulus         = youngsModulus.X;
                material.ThermalExpansionCoeff = thermalExpansionCoeff.X;
                material.PoissonsRatio         = poissonsRatio.X;
            }
            else if (toMaterial is Timber)
            {
                Timber material = toMaterial as Timber;
                material.YoungsModulus         = youngsModulus;
                material.ThermalExpansionCoeff = thermalExpansionCoeff;
                material.PoissonsRatio         = poissonsRatio;
            }
            else if (toMaterial is GenericIsotropicMaterial)
            {
                GenericIsotropicMaterial material = toMaterial as GenericIsotropicMaterial;
                material.YoungsModulus         = youngsModulus.X;
                material.ThermalExpansionCoeff = thermalExpansionCoeff.X;
                material.PoissonsRatio         = poissonsRatio.X;
            }
        }
コード例 #4
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static IMaterialFragment ToMaterial(this IFAttribute lusasAttribute)
        {
            string attributeName = GetName(lusasAttribute);

            IMaterialFragment material = null;

            if (lusasAttribute is IFMaterialIsotropic)
            {
                material = new GenericIsotropicMaterial()
                {
                    Name                  = attributeName,
                    YoungsModulus         = lusasAttribute.getValue("E"),
                    PoissonsRatio         = lusasAttribute.getValue("nu"),
                    ThermalExpansionCoeff = lusasAttribute.getValue("alpha"),
                    Density               = lusasAttribute.getValue("rho")
                };
            }
            else if (lusasAttribute is IFMaterialOrthotropic)
            {
                material = Engine.Structure.Create.Timber(
                    attributeName,
                    new Vector()
                {
                    X = lusasAttribute.getValue("Ex"), Y = lusasAttribute.getValue("Ey"), Z = lusasAttribute.getValue("Ez")
                },
                    new Vector()
                {
                    X = lusasAttribute.getValue("nuxy"), Y = lusasAttribute.getValue("nuyz"), Z = lusasAttribute.getValue("nuzx")
                },
                    new Vector()
                {
                    X = lusasAttribute.getValue("Gxy"), Y = 0.0, Z = 0.0
                },
                    new Vector()
                {
                    X = lusasAttribute.getValue("ax"), Y = lusasAttribute.getValue("ay"), Z = lusasAttribute.getValue("az")
                },
                    lusasAttribute.getValue("rho"), 0);
            }

            int adapterNameId = lusasAttribute.getID();

            material.SetAdapterId(typeof(LusasId), adapterNameId);


            return(material);
        }
コード例 #5
0
ファイル: MaterialType.cs プロジェクト: BHoM/BHoM_Engine
 public static MaterialType MaterialType(this GenericIsotropicMaterial materialFragment)
 {
     return(materialFragment.IsNull() ? oM.Structure.MaterialFragments.MaterialType.Undefined : oM.Structure.MaterialFragments.MaterialType.Undefined);
 }
コード例 #6
0
ファイル: Material.cs プロジェクト: BHoM/SAP2000_Toolkit
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private List <IMaterialFragment> ReadMaterial(List <string> ids = null)
        {
            List <IMaterialFragment> materialList = new List <IMaterialFragment>();

            int nameCount = 0;

            string[] nameArr = { };
            m_model.PropMaterial.GetNameList(ref nameCount, ref nameArr);

            ids = FilterIds(ids, nameArr);

            foreach (string id in ids)
            {
                eMatType matType = eMatType.NoDesign;
                int      symType = 0;
                int      colour  = 0;
                string   guid    = "";
                string   notes   = "";

                if (m_model.PropMaterial.GetMaterial(id, ref matType, ref colour, ref notes, ref guid) == 0)
                {
                    IMaterialFragment bhMaterial;

                    m_model.PropMaterial.GetTypeOAPI(id, ref matType, ref symType);

                    double e       = 0;
                    double v       = 0;
                    double thermCo = 0;
                    double g       = 0;

                    double[] E       = new double[3];
                    double[] V       = new double[3];
                    double[] ThermCo = new double[3];
                    double[] G       = new double[3];

                    if (symType == 0)// Isotropic
                    {
                        m_model.PropMaterial.GetMPIsotropic(id, ref e, ref v, ref thermCo, ref g);
                    }
                    else if (symType == 1) // Orthotropic
                    {
                        m_model.PropMaterial.GetMPOrthotropic(id, ref E, ref V, ref ThermCo, ref G);
                    }
                    else if (symType == 2) //Anisotropic
                    {
                        m_model.PropMaterial.GetMPAnisotropic(id, ref E, ref V, ref ThermCo, ref G);
                    }
                    else if (symType == 3) //Uniaxial
                    {
                        m_model.PropMaterial.GetMPUniaxial(id, ref e, ref thermCo);
                    }

                    double mass   = 0;
                    double weight = 0;

                    m_model.PropMaterial.GetWeightAndMass(id, ref weight, ref mass);

                    double fc              = 0;     //compressive stress
                    double ft              = 0;     //tensile stress
                    double fy              = 0;     //yield stress
                    double fu              = 0;     //ultimate stress
                    double efy             = 0;     //expected yield stress
                    double efu             = 0;     //expected tensile stress
                    double strainHardening = 0;     //strain at hardening
                    double strainMaxF      = 0;     //strain at max stress
                    double strainRupture   = 0;     //strain at rupture
                    double strainFc        = 0;     //strain at f'c
                    int    i0              = 0;     //stress-strain curvetype
                    int    i1              = 0;     //stress-strain hysteresis type
                    bool   b0              = false; //is lightweight


                    switch (matType)
                    {
                    case eMatType.Steel:
                        m_model.PropMaterial.GetOSteel(id, ref fy, ref fu, ref efy, ref efu, ref i0, ref i1, ref strainHardening, ref strainMaxF, ref strainRupture);
                        bhMaterial = Engine.Structure.Create.Steel(id, e, v, thermCo, mass, 0, fy, fu);
                        break;

                    case eMatType.Concrete:
                        m_model.PropMaterial.GetOConcrete(id, ref fc, ref b0, ref ft, ref i0, ref i1, ref efy, ref efu, ref strainFc, ref strainMaxF);
                        bhMaterial = Engine.Structure.Create.Concrete(id, e, v, thermCo, mass, 0, 0, fy);
                        break;

                    case eMatType.Aluminum:
                        bhMaterial = Engine.Structure.Create.Aluminium(id, e, v, thermCo, mass, 0);
                        break;

                    case eMatType.ColdFormed:
                        m_model.PropMaterial.GetOColdFormed(id, ref fy, ref fu, ref i1);
                        bhMaterial = Engine.Structure.Create.Steel(id, e, v, thermCo, mass, 0, fy, fu);
                        break;

                    case eMatType.Rebar:
                        m_model.PropMaterial.GetORebar(id, ref fy, ref fu, ref efy, ref efu, ref i0, ref i1, ref strainHardening, ref strainMaxF, ref b0);
                        bhMaterial = Engine.Structure.Create.Steel(id, e, v, thermCo, mass, 0, fy, fu);
                        break;

                    case eMatType.Tendon:
                        m_model.PropMaterial.GetOTendon(id, ref fy, ref fu, ref i0, ref i1);
                        bhMaterial = Engine.Structure.Create.Steel(id, e, v, thermCo, mass, 0, fy, fu);
                        break;

                    case eMatType.NoDesign:
                        switch (symType)
                        {
                        case 0:
                            bhMaterial = new GenericIsotropicMaterial()
                            {
                                Name = id, YoungsModulus = e, PoissonsRatio = v, ThermalExpansionCoeff = thermCo, Density = mass
                            };
                            break;

                        case 1:
                            bhMaterial = new GenericOrthotropicMaterial()
                            {
                                Name = id, YoungsModulus = E.ToVector(), PoissonsRatio = V.ToVector(), ThermalExpansionCoeff = ThermCo.ToVector(), Density = mass
                            };
                            break;

                        case 2:
                        case 3:
                        default:
                            bhMaterial = Engine.Structure.Create.Steel(id);
                            Engine.Base.Compute.RecordWarning("Could not extract structural properties for material " + id);
                            break;
                        }
                        break;

                    default:
                        bhMaterial = Engine.Structure.Create.Steel(id);
                        Engine.Base.Compute.RecordWarning("Could not extract structural properties for material " + id);
                        break;
                    }

                    SetAdapterId(bhMaterial, id);

                    materialList.Add(bhMaterial);
                }
            }

            return(materialList);
        }
コード例 #7
0
ファイル: Material.cs プロジェクト: BHoM/ETABS_Toolkit
        /***************************************************/

        private List <IMaterialFragment> ReadMaterial(List <string> ids = null)
        {
            int nameCount = 0;

            string[] names = { };
            List <IMaterialFragment> materialList = new List <IMaterialFragment>();

            m_model.PropMaterial.GetNameList(ref nameCount, ref names);

            ids = FilterIds(ids, names);

            foreach (string id in ids)
            {
                eMatType matType = eMatType.NoDesign;
                int      colour  = 0;
                string   guid    = null;
                string   notes   = "";
                if (m_model.PropMaterial.GetMaterial(id, ref matType, ref colour, ref notes, ref guid) == 0)
                {
                    IMaterialFragment m = null;

                    double e       = 0;
                    double v       = 0;
                    double thermCo = 0;
                    double g       = 0;
                    double mass    = 0;
                    double weight  = 0;
                    m_model.PropMaterial.GetWeightAndMass(id, ref weight, ref mass);
                    if (m_model.PropMaterial.GetMPIsotropic(id, ref e, ref v, ref thermCo, ref g) != 0)
                    {
                        double[] eArr = new double[3];
                        double[] vArr = new double[3];
                        double[] aArr = new double[3];
                        double[] gArr = new double[3];
                        if (m_model.PropMaterial.GetMPOrthotropic(id, ref eArr, ref vArr, ref aArr, ref gArr) != 0)
                        {
                            string msg = string.Format("Could not extract structural properties for material {0}, this has been replaced with a GenericIsotropicMaterial with no properties.", id);
                            Engine.Base.Compute.RecordWarning(msg);
                            m = new GenericIsotropicMaterial()
                            {
                                Name = id + "_replacment"
                            };
                        }
                        else
                        {
                            m = new GenericOrthotropicMaterial()
                            {
                                Name                  = id,
                                YoungsModulus         = eArr.ToVector(),
                                PoissonsRatio         = vArr.ToVector(),
                                ShearModulus          = gArr.ToVector(),
                                ThermalExpansionCoeff = aArr.ToVector(),
                                Density               = mass
                            };
                        }
                    }
                    else
                    {
                        double compStr    = 0;
                        double tensStr    = 0;
                        double fy         = 0; //expected yield stress
                        double fu         = 0; //expected tensile stress
                        double efy        = 0; //expected yield stress
                        double efu        = 0; //expected tensile stress
                        double v3         = 0; //strain at hardening
                        double v4         = 0; //strain at max stress
                        double v5         = 0; //strain at rupture
                        double strainAtFc = 0;
                        double strainUlt  = 0;
                        int    i1         = 0;//stress-strain curvetype
                        int    i2         = 0;

                        bool b1 = false;

                        if (m_model.PropMaterial.GetOSteel(id, ref fy, ref fu, ref efy, ref efu, ref i1, ref i2, ref v3, ref v4, ref v5) == 0 || matType == eMatType.Steel || matType == eMatType.ColdFormed ||
                            m_model.PropMaterial.GetORebar(id, ref fy, ref fu, ref efy, ref efu, ref i1, ref i2, ref v3, ref v4, ref b1) == 0 || matType == eMatType.Rebar ||
                            m_model.PropMaterial.GetOTendon(id, ref fy, ref fu, ref i1, ref i2) == 0 || matType == eMatType.Tendon)
                        {
                            m = new Steel()
                            {
                                Name                  = id,
                                YoungsModulus         = e,
                                PoissonsRatio         = v,
                                ThermalExpansionCoeff = thermCo,
                                Density               = mass,
                                YieldStress           = fy,
                                UltimateStress        = fu
                            };
                        }
                        else if (m_model.PropMaterial.GetOConcrete(id, ref compStr, ref b1, ref tensStr, ref i1, ref i2, ref strainAtFc, ref strainUlt, ref v3, ref v4) == 0 || matType == eMatType.Concrete)
                        {
                            m = new Concrete()
                            {
                                Name                  = id,
                                YoungsModulus         = e,
                                PoissonsRatio         = v,
                                ThermalExpansionCoeff = thermCo,
                                Density               = mass,
                                CylinderStrength      = compStr
                            };
                        }
                        else if (matType == eMatType.Aluminum)
                        {
                            m = new Aluminium()
                            {
                                Name                  = id,
                                YoungsModulus         = e,
                                PoissonsRatio         = v,
                                ThermalExpansionCoeff = thermCo,
                                Density               = mass
                            };
                        }
                        else
                        {
                            string msg = string.Format("Could not extract structural properties for material {0}, this has been replaced with a GenericIsotropicMaterial with no properties.", id);
                            Engine.Base.Compute.RecordWarning(msg);
                            m = new GenericIsotropicMaterial()
                            {
                                Name = id + "_replacment"
                            };
                        }
                    }

                    SetAdapterId(m, id);
                    materialList.Add(m);
                }
            }

            return(materialList);
        }
コード例 #8
0
        /***************************************************/

        private List <ISectionProperty> ReadSectionProperty(List <string> ids = null)
        {
            List <ISectionProperty> propList = new List <ISectionProperty>();
            Dictionary <String, IMaterialFragment> bhomMaterials = ReadMaterial().ToDictionary(x => x.DescriptionOrName());

            int nameCount = 0;

            string[] names = { };
            m_model.PropFrame.GetNameList(ref nameCount, ref names);

            ids = FilterIds(ids, names);

            eFramePropType propertyType = eFramePropType.General;

            List <string> backlog = new List <string>();

            do
            {
                foreach (string id in ids)
                {
                    m_model.PropFrame.GetTypeOAPI((string)id, ref propertyType);

                    ISectionProperty bhSectionProperty = null;
                    IProfile         dimensions        = null;
                    string           materialName      = "";

                    string fileName = "";
                    double t3       = 0;
                    double t2       = 0;
                    double tf       = 0;
                    double tw       = 0;
                    double twt      = 0;
                    double tfb      = 0;
                    double t2b      = 0;
                    int    colour   = 0;
                    string notes    = "";
                    string guid     = null;

                    bool verticalFlip = false;
                    bool horFlip      = false;

                    double Area, As2, As3, Torsion, I22, I33, S22, S33, Z22, Z33, R22, R33;
                    Area = As2 = As3 = Torsion = I22 = I33 = S22 = S33 = Z22 = Z33 = R22 = R33 = 0;

                    string constructSelector = "fromDimensions";

                    #region long switch on section property type
                    switch (propertyType)
                    {
                    case eFramePropType.I:
                        m_model.PropFrame.GetISection(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref t2b, ref tfb, ref colour, ref notes, ref guid);
                        if (t2 == t2b)
                        {
                            dimensions = Engine.Spatial.Create.ISectionProfile(t3, t2, tw, tf, 0, 0);
                        }
                        else
                        {
                            dimensions = Engine.Spatial.Create.FabricatedISectionProfile(t3, t2, t2b, tw, tf, tfb, 0);
                        }
                        break;

                    case eFramePropType.Channel:
                        m_model.PropFrame.GetChannel(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.ChannelProfile(t3, t2, tw, tf, 0, 0);
                        break;

                    case eFramePropType.T:
                        break;

                    case eFramePropType.Angle:
                        m_model.PropFrame.GetAngle(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.AngleProfile(t3, t2, tw, tf, 0, 0);
                        break;

                    case eFramePropType.DblAngle:
                        break;

                    case eFramePropType.Box:
                        m_model.PropFrame.GetTube(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref colour, ref notes, ref guid);
                        if (tf == tw)
                        {
                            dimensions = Engine.Spatial.Create.BoxProfile(t3, t2, tf, 0, 0);
                        }
                        else
                        {
                            dimensions = Engine.Spatial.Create.FabricatedBoxProfile(t3, t2, tw, tf, tf, 0);
                        }
                        break;

                    case eFramePropType.Pipe:
                        m_model.PropFrame.GetPipe(id, ref fileName, ref materialName, ref t3, ref tw, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.TubeProfile(t3, tw);
                        break;

                    case eFramePropType.Rectangular:
                        m_model.PropFrame.GetRectangle(id, ref fileName, ref materialName, ref t3, ref t2, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.RectangleProfile(t3, t2, 0);
                        break;

                    case eFramePropType.Auto:    //not member will have this assigned but it still exists in the propertyType list
                        dimensions = Engine.Spatial.Create.CircleProfile(0.2);
                        break;

                    case eFramePropType.Circle:
                        m_model.PropFrame.GetCircle(id, ref fileName, ref materialName, ref t3, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.CircleProfile(t3);
                        break;

                    case eFramePropType.General:
                        constructSelector = "explicit";
                        m_model.PropFrame.GetGeneral(id, ref fileName, ref materialName, ref t3, ref t2, ref Area, ref As2, ref As3, ref Torsion, ref I22, ref I33, ref S22, ref S33, ref Z22, ref Z33, ref R22, ref R33, ref colour, ref notes, ref guid);
                        break;

                    case eFramePropType.DbChannel:
                        break;

                    case eFramePropType.SD:
                        break;

                    case eFramePropType.Variable:

                        if (!backlog.Contains(id))
                        {
                            // the sub sections need to exist to get their profiles
                            backlog.Add(id);
                            continue;
                        }
                        backlog.Remove(id);

                        int      numberItems = 0;
                        string[] startSec    = null;
                        string[] endSec      = null;
                        double[] myLength    = null;
                        int[]    myType      = null;
                        int[]    ei33        = null;
                        int[]    ei22        = null;

                        m_model.PropFrame.GetNonPrismatic(id, ref numberItems, ref startSec, ref endSec, ref myLength, ref myType, ref ei33, ref ei22, ref colour, ref notes, ref guid);

                        // Check type
                        if (myType.Any(x => x != 1))
                        {
                            Engine.Base.Compute.RecordWarning("BhoM can only pull Non-prismatic sections with relative length values.");
                            break;
                        }

                        // convert length values to relative positions between 0 and 1
                        List <double> positions = new List <double>()
                        {
                            0
                        };
                        for (int i = 0; i < myLength.Length; i++)
                        {
                            positions.Add(System.Convert.ToDouble(myLength[i]) + positions[i]);
                        }
                        double totLength = myLength.Sum();
                        positions = positions.Select(x => x / System.Convert.ToDouble(totLength)).ToList();

                        // Getting a Profile from a name in the propList
                        Func <string, IProfile> getProfile = sectionName =>
                        {
                            ISectionProperty sec = propList.First(x => x.DescriptionOrName() == sectionName);
                            if (sec is IGeometricalSection)
                            {
                                return((sec as IGeometricalSection).SectionProfile);
                            }
                            else
                            {
                                return(null);
                            }
                        };

                        // convert start/end section for each segment to a list of profiles (where each profile is both start and end for two segments)
                        List <IProfile> profiles = new List <IProfile>();
                        profiles.Add(getProfile(startSec.First()));
                        endSec.ToList().ForEach(x => profiles.Add(getProfile(x)));

                        // check that start/end section are equal
                        for (int i = numberItems - 1; i >= 1; i--)
                        {
                            if (startSec[i] != endSec[i - 1])
                            {
                                profiles.Insert(i + 1, getProfile(startSec[i]));
                                positions.Insert(i + 1, positions[i] + System.Convert.ToDouble(Tolerance.Distance));
                            }
                        }

                        // Find the material of all elements and create a singel one (or have warning)
                        foreach (string subSectionName in startSec.Concat(endSec))
                        {
                            ISectionProperty sec = propList.First(x => x.DescriptionOrName() == subSectionName);
                            if (materialName == "")
                            {
                                materialName = sec.Material.DescriptionOrName();
                            }
                            else if (materialName != sec.Material.DescriptionOrName())
                            {
                                materialName = "";
                                Engine.Base.Compute.RecordWarning("All sub-sections must have the same material.");
                                break;
                            }
                        }

                        //Etabs can only accept sections that vary linearly along it's length
                        List <int> interpolationOrder = Enumerable.Repeat(1, positions.Count - 1).ToList();

                        if (profiles.Any(x => x == null))
                        {
                            Engine.Base.Compute.RecordNote("Tapered profiles require the sub-profiles to be geometrically defined, they can not be any kind of explicit section.");
                        }
                        else
                        {
                            dimensions = Engine.Spatial.Create.TaperedProfile(positions, profiles, interpolationOrder);
                        }
                        break;

                    case eFramePropType.Joist:
                        break;

                    case eFramePropType.Bridge:
                        break;

                    case eFramePropType.Cold_C:
                        break;

                    case eFramePropType.Cold_2C:
                        break;

                    case eFramePropType.Cold_Z:
                        break;

                    case eFramePropType.Cold_L:
                        break;

                    case eFramePropType.Cold_2L:
                        break;

                    case eFramePropType.Cold_Hat:
                        break;

                    case eFramePropType.BuiltupICoverplate:
                        break;

                    case eFramePropType.PCCGirderI:
                        break;

                    case eFramePropType.PCCGirderU:
                        break;

                    case eFramePropType.BuiltupIHybrid:
                        break;

                    case eFramePropType.BuiltupUHybrid:
                        break;

                    case eFramePropType.Concrete_L:
                        m_model.PropFrame.GetConcreteL(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref twt, ref horFlip, ref verticalFlip, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.AngleProfile(t3, t2, tw, tf, 0, 0, horFlip, verticalFlip);
                        break;

                    case eFramePropType.FilledTube:
                        break;

                    case eFramePropType.FilledPipe:
                        break;

                    case eFramePropType.EncasedRectangle:
                        break;

                    case eFramePropType.EncasedCircle:
                        break;

                    case eFramePropType.BucklingRestrainedBrace:
                        break;

                    case eFramePropType.CoreBrace_BRB:
                        break;

                    case eFramePropType.ConcreteTee:
                        m_model.PropFrame.GetConcreteTee(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref twt, ref verticalFlip, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.TSectionProfile(t3, t2, tw, tf, 0, 0, verticalFlip);
                        break;

                    case eFramePropType.ConcreteBox:
                        m_model.PropFrame.GetTube(id, ref fileName, ref materialName, ref t3, ref t2, ref tf, ref tw, ref colour, ref notes, ref guid);
                        if (tf == tw)
                        {
                            dimensions = Engine.Spatial.Create.BoxProfile(t3, t2, tf, 0, 0);
                        }
                        else
                        {
                            dimensions = Engine.Spatial.Create.FabricatedBoxProfile(t3, t2, tw, tf, tf, 0);
                        }
                        break;

                    case eFramePropType.ConcretePipe:
                        m_model.PropFrame.GetPipe(id, ref fileName, ref materialName, ref t3, ref tw, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.TubeProfile(t3, tw);
                        break;

                    case eFramePropType.ConcreteCross:
                        break;

                    case eFramePropType.SteelPlate:
                        m_model.PropFrame.GetPlate(id, ref fileName, ref materialName, ref t3, ref t2, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.RectangleProfile(t3, t2, 0);
                        break;

                    case eFramePropType.SteelRod:
                        m_model.PropFrame.GetRod(id, ref fileName, ref materialName, ref t3, ref colour, ref notes, ref guid);
                        dimensions = Engine.Spatial.Create.CircleProfile(t3);
                        break;

                    default:
                        break;
                    }
                    if (dimensions == null)
                    {
                        Engine.Base.Compute.RecordNote(propertyType.ToString() + " properties are not implemented in ETABS adapter. An empty section has been returned.");
                        constructSelector = "explicit";
                    }
                    #endregion


                    IMaterialFragment material;

                    if (!bhomMaterials.TryGetValue(materialName, out material))
                    {
                        material = new GenericIsotropicMaterial()
                        {
                            Name = materialName
                        };
                        Engine.Base.Compute.RecordNote("Could not get material from ETABS. GenericIsotropic material with 0 values have been extracted in its place.");
                    }

                    switch (constructSelector)
                    {
                    case "fromDimensions":
                        bhSectionProperty = Engine.Structure.Create.SectionPropertyFromProfile(dimensions, material, id);
                        break;

                    case "explicit":
                        bhSectionProperty = new ExplicitSection()
                        {
                            Area = Area,
                            Asy  = As2,
                            Asz  = As3,
                            Iy   = I22,
                            Iz   = I33,
                            J    = Torsion,
                            Rgy  = R22,
                            Rgz  = R33,
                            Wply = S22,    //capacity - plastic (wply)
                            Wplz = S33,
                            Wely = Z22,    //capacity elastic
                            Welz = Z33
                        };
                        bhSectionProperty.Material = material;
                        bhSectionProperty.Name     = id;

                        break;

                    default:
                        continue;
                    }
                    SetAdapterId(bhSectionProperty, id);

                    double[] modifiers = null;
                    if (m_model.PropFrame.GetModifiers(id, ref modifiers) == 0 && modifiers != null && modifiers.Length > 6 && modifiers.Any(x => x != 1))
                    {
                        SectionModifier modifier = new SectionModifier
                        {
                            Area = modifiers[0],
                            Asz  = modifiers[1],
                            Asy  = modifiers[2],
                            J    = modifiers[3],
                            Iz   = modifiers[4],
                            Iy   = modifiers[5]
                        };
                        bhSectionProperty.Fragments.Add(modifier);
                    }

                    propList.Add(bhSectionProperty);
                }
                ids = new List <string>(backlog);
            } while (backlog.Count > 0);

            return(propList);
        }
コード例 #9
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private List <ISurfaceProperty> ReadSurfaceProperty(List <string> ids = null)
        {
            List <ISurfaceProperty> propertyList = new List <ISurfaceProperty>();

            Dictionary <string, IMaterialFragment> bhomMaterials = ReadMaterial().ToDictionary(x => GetAdapterId <string>(x));

            int nameCount = 0;

            string[] nameArr = { };
            m_model.PropArea.GetNameList(ref nameCount, ref nameArr);

            ids = FilterIds(ids, nameArr);

            foreach (string id in ids)
            {
                int       shellType          = 0;
                bool      includeDrillingDOF = true;
                string    materialName       = "";
                double    matAng             = 0;
                double    thickness          = 0;
                double    bending            = 0;
                int       color     = 0;
                string    notes     = "";
                string    guid      = null;
                SAP2000Id sap2000id = new SAP2000Id();
                sap2000id.Id = id;


                if (m_model.PropArea.GetShell_1(id, ref shellType, ref includeDrillingDOF, ref materialName, ref matAng, ref thickness, ref bending, ref color, ref notes, ref guid) != 0)
                {
                    Engine.Base.Compute.RecordWarning($"Error while pulling Surface Property {id}. Check results carefully.");
                }

                ConstantThickness bhSurfProp = new ConstantThickness();

                bhSurfProp.Name      = id;
                bhSurfProp.Thickness = thickness;
                bhSurfProp.CustomData.Add("MaterialAngle", matAng);
                bhSurfProp.CustomData.Add("BendingThickness", bending);
                bhSurfProp.CustomData.Add("Color", color);
                bhSurfProp.CustomData.Add("Notes", notes);
                bhSurfProp.CustomData.Add("GUID", guid);

                IMaterialFragment bhMat = new GenericIsotropicMaterial();
                bhomMaterials.TryGetValue(materialName, out bhMat);
                bhSurfProp.Material = bhMat;

                double[] modifiers = new double[6];

                if (m_model.PropArea.GetModifiers(id, ref modifiers) == 0)
                {
                    SurfacePropertyModifier modifier = new SurfacePropertyModifier
                    {
                        FXX    = modifiers[0],
                        FYY    = modifiers[1],
                        FXY    = modifiers[2],
                        MXX    = modifiers[3],
                        MYY    = modifiers[4],
                        MXY    = modifiers[5],
                        VXZ    = modifiers[6],
                        VYZ    = modifiers[7],
                        Mass   = modifiers[8],
                        Weight = modifiers[9]
                    };
                    bhSurfProp.Fragments.Add(modifier);
                }

                bhSurfProp.SetAdapterId(sap2000id);
                propertyList.Add(bhSurfProp);
            }

            return(propertyList);
        }
コード例 #10
0
        /***************************************************/
        /****               Public Methods              ****/
        /***************************************************/

        public static IMaterialFragment MaterialFragmentFromRevit(this Material material, string grade = null, RevitSettings settings = null, Dictionary <string, List <IBHoMObject> > refObjects = null)
        {
            if (material == null)
            {
                return(null);
            }

            string            refId            = material.Id.ReferenceIdentifier(grade);
            IMaterialFragment materialFragment = refObjects.GetValue <IMaterialFragment>(refId);

            if (materialFragment != null)
            {
                return(materialFragment);
            }

            settings = settings.DefaultIfNull();

            StructuralMaterialType structuralMaterialType = material.MaterialClass.StructuralMaterialType();

            materialFragment = structuralMaterialType.LibraryMaterial(grade);
            if (materialFragment != null)
            {
                return(materialFragment);
            }

            Compute.MaterialNotInLibraryNote(material);

            switch (structuralMaterialType)
            {
            case StructuralMaterialType.Concrete:
            case StructuralMaterialType.PrecastConcrete:
                materialFragment = new Concrete();
                break;

            case StructuralMaterialType.Aluminum:
                materialFragment = new Aluminium();
                break;

            case StructuralMaterialType.Steel:
                materialFragment = new Steel();
                break;

            case StructuralMaterialType.Wood:
                materialFragment = new Timber();
                break;

            default:
                BH.Engine.Reflection.Compute.RecordWarning(String.Format("Revit material of structural type {0} is currently not supported, the material was converted to a generic isotropic BHoM material. Revit ElementId: {1}", structuralMaterialType, material.Id.IntegerValue));
                materialFragment = new GenericIsotropicMaterial();
                break;
            }

            materialFragment.CopyCharacteristics(material);

            string name = material.Name;

            if (!string.IsNullOrWhiteSpace(grade))
            {
                name += " grade " + grade;
            }

            materialFragment.Name = name;

            refObjects.AddOrReplace(refId, materialFragment);
            return(materialFragment);
        }