示例#1
0
        /***************************************************/
        /**** Private methods                           ****/
        /***************************************************/

        private List <ISectionProperty> ReadSectionProperties(List <int> ids = null)
        {
            int err = 0;
            List <ISectionProperty> beamSections = new List <ISectionProperty>();

            int[] propCount       = new int[St7.kMaxEntityTotals - 1];
            int[] propLastNumbers = new int[St7.kMaxEntityTotals - 1];
            err = St7.St7GetTotalProperties(1, propCount, propLastNumbers);
            if (!St7Error(err))
            {
                return(beamSections);
            }
            int numberOfBeamProps = propCount[St7.ipBeamPropTotal];

            for (int pp = 0; pp < numberOfBeamProps; pp++)
            {
                int propNumber = 0;
                err = St7.St7GetPropertyNumByIndex(1, St7.ptBEAMPROP, pp + 1, ref propNumber);
                if (!St7Error(err))
                {
                    return(beamSections);
                }
                int           sectionTypeVar = 0;
                double[]      dimArray       = new double[6];
                StringBuilder propertyName   = new StringBuilder(St7.kMaxStrLen);
                err = St7.St7GetBeamSectionGeometry(1, propNumber, ref sectionTypeVar, dimArray);
                if (!St7Error(err))
                {
                    return(beamSections);
                }
                err = St7.St7GetPropertyName(1, St7.ptBEAMPROP, propNumber, propertyName, St7.kMaxStrLen);
                if (!St7Error(err))
                {
                    return(beamSections);
                }
                IMaterialFragment material = GetBeamPropertyMaterial(propNumber);
                IProfile          sectionProfile;
                switch (sectionTypeVar)
                {
                case St7.bsNullSection:
                    sectionProfile = null;
                    break;

                case St7.bsCircularSolid:
                    sectionProfile = Engine.Spatial.Create.CircleProfile(dimArray[0]);
                    break;

                case St7.bsCircularHollow:
                    sectionProfile = BH.Engine.Spatial.Create.TubeProfile(dimArray[0], dimArray[3]);
                    break;

                case St7.bsSquareSolid:
                    sectionProfile = BH.Engine.Spatial.Create.RectangleProfile(dimArray[1], dimArray[0], 0);
                    break;

                case St7.bsSquareHollow:
                    sectionProfile = BH.Engine.Spatial.Create.FabricatedBoxProfile(dimArray[1], dimArray[0], dimArray[4], dimArray[3], dimArray[3], 0);
                    break;

                case St7.bsTSection:
                    sectionProfile = BH.Engine.Spatial.Create.TSectionProfile(dimArray[1], dimArray[0], dimArray[4], dimArray[3], 0, 0);
                    break;

                case St7.bsLipChannel:
                    sectionProfile = BH.Engine.Spatial.Create.ChannelProfile(dimArray[1], dimArray[0], dimArray[4], dimArray[3], 0, 0);
                    break;

                case St7.bsTopHatChannel:
                    sectionProfile = null;
                    break;

                case St7.bsISection:
                    sectionProfile = BH.Engine.Spatial.Create.FabricatedISectionProfile(dimArray[2], dimArray[0], dimArray[1], dimArray[5], dimArray[3], dimArray[4], 0);
                    break;

                case St7.bsLSection:
                    sectionProfile = BH.Engine.Spatial.Create.AngleProfile(dimArray[1], dimArray[0], dimArray[4], dimArray[3], 0, 0);
                    break;

                case St7.bsZSection:
                    sectionProfile = BH.Engine.Spatial.Create.ZSectionProfile(dimArray[2], dimArray[0], dimArray[5], dimArray[3], 0, 0);
                    break;

                case St7.bsUserSection:
                    sectionProfile = null;
                    break;

                case St7.bsTrapezoidSolid:
                    sectionProfile = null;
                    break;

                case St7.bsTrapezoidHollow:
                    sectionProfile = null;
                    break;

                case St7.bsTriangleSolid:
                    sectionProfile = null;
                    break;

                case St7.bsTriangleHollow:
                    sectionProfile = null;
                    break;

                case St7.bsCruciform:
                    sectionProfile = null;
                    break;

                default:
                    sectionProfile = null;
                    break;
                }
                ISectionProperty sectionProperty = null;
                if (material is null || sectionProfile is null)
                {
                    continue;
                }
                if (material is Concrete)
                {
                    sectionProperty = BH.Engine.Structure.Create.ConcreteSectionFromProfile(sectionProfile, (Concrete)material, propertyName.ToString());
                }
                else
                {
                    sectionProperty = BH.Engine.Structure.Create.SteelSectionFromProfile(sectionProfile, (Steel)material, propertyName.ToString());
                }
                SetAdapterId(sectionProperty, propNumber);
                beamSections.Add(sectionProperty);
            }
            return(beamSections);
        }