Beispiel #1
0
        public static BeamResults St7GetBeamResultsAtT(BHoMAdapter st7Adapter, List <int> caseIds, List <Bar> beams, List <double> t_params, St7ResultForceComponent component, St7BeamResultsTypes resultType = St7BeamResultsTypes.BeamForce, St7BeamResultAxis resultAxis = St7BeamResultAxis.Principal, bool active = false)
        {
            if (!active)
            {
                return(null);
            }
            int err;
            int uID = 1;

            err = St7.St7SetBeamResultPosMode(uID, St7.bpParam);
            List <List <double> > valuesResults     = new List <List <double> >();
            List <List <int> >    resultsPerStation = new List <List <int> >();

            // output from strand 7

            double[] beamResult  = new double[St7.kMaxBeamResult];
            int      numStations = 1;
            int      numColumns  = 0;

            for (int i = 0; i < beams.Count; i++)
            {
                Bar      beam = beams[i];
                double[] beamPos;
                if (i > t_params.Count - 1)
                {
                    beamPos = new double[] { t_params[t_params.Count - 1] };
                }
                else
                {
                    beamPos = new double[] { t_params[i] }
                };
                int beamId = st7Adapter.GetAdapterId <int>(beam);

                List <double> interValues        = new List <double>();
                List <int>    interResPerStation = new List <int>();
                foreach (int loadcaseId in caseIds)
                {
                    err = St7.St7GetBeamResultArrayPos(uID, (int)resultType, (int)resultAxis, beamId, loadcaseId, numStations, beamPos, ref numColumns, beamResult);
                    if (component == St7ResultForceComponent.All)
                    {
                        interResPerStation.Add(numColumns);
                    }
                    else
                    {
                        interResPerStation.Add(1);
                    }
                    if (component == St7ResultForceComponent.All)
                    {
                        interValues.AddRange(beamResult.Take(numStations * numColumns));
                    }
                    else
                    {
                        for (int j = 0; j < numStations; j++)
                        {
                            interValues.Add(beamResult[(int)component + j * numColumns]);
                        }
                    }
                }
                valuesResults.Add(interValues);
                resultsPerStation.Add(interResPerStation);
            }
            return(new BeamResults(true, new List <List <double> >(), valuesResults, new List <List <int> >(), resultsPerStation));
        }