示例#1
0
        private List <ILoad> ReadAreaLoad(List <Loadcase> loadcases)
        {
            int          uID            = 1;
            int          err            = 0;
            List <ILoad> bhLoads        = new List <ILoad>();
            List <Panel> bhPanels       = ReadPanel();
            Vector       localPressure  = new Vector();
            Vector       globalPressure = new Vector();

            foreach (Loadcase ldcs in loadcases)
            {
                int ldcsId = GetAdapterId <int>(ldcs);
                foreach (Panel panel in bhPanels)
                {
                    BHoMGroup <IAreaElement> panelObjects = new BHoMGroup <IAreaElement>()
                    {
                        Elements = { panel }
                    };
                    int panelId = GetAdapterId <int>(panel);

                    // local pressures
                    double[] normalPressures = new double[2];
                    err = St7.St7GetPlateNormalPressure2(uID, panelId, ldcsId, normalPressures);
                    double[] shearPressures = new double[2];
                    err           = St7.St7GetPlateShear2(uID, panelId, ldcsId, shearPressures);
                    localPressure = Vector.ZAxis * (normalPressures[0] - normalPressures[1]) + Vector.XAxis * shearPressures[0] + Vector.YAxis * shearPressures[1];
                    if (localPressure.Length() > 0)
                    {
                        bhLoads.Add(new AreaUniformlyDistributedLoad()
                        {
                            Loadcase = ldcs, Pressure = localPressure, Objects = panelObjects, Axis = LoadAxis.Local, Projected = false
                        });
                    }

                    // global pressures
                    double[] globalPressuresZplus  = new double[3];
                    double[] globalPressuresZminus = new double[3];
                    int      projectionFlag        = 0;
                    err            = St7.St7GetPlateGlobalPressure3S(uID, panelId, St7.psPlateZPlus, ldcsId, ref projectionFlag, globalPressuresZplus);
                    err            = St7.St7GetPlateGlobalPressure3S(uID, panelId, St7.psPlateZMinus, ldcsId, ref projectionFlag, globalPressuresZminus);
                    globalPressure = BH.Engine.Geometry.Create.Vector(globalPressuresZplus[0] + globalPressuresZminus[0], globalPressuresZplus[1] + globalPressuresZminus[1], globalPressuresZplus[2] + globalPressuresZminus[2]);
                    bool projected = projectionFlag != St7.ppNone;
                    if (globalPressure.Length() > 0)
                    {
                        bhLoads.Add(new AreaUniformlyDistributedLoad()
                        {
                            Loadcase = ldcs, Pressure = globalPressure, Objects = panelObjects, Axis = LoadAxis.Global, Projected = projected
                        });
                    }
                }
            }
            return(bhLoads);
        }