Пример #1
0
        /***************************************************/

        private bool CreateObject(LoadCombination loadcombination)
        {
            eCNameType nameType = eCNameType.LoadCase;

            int caseNameCount = 0;

            string[] caseNameArr = null;

            m_model.LoadPatterns.GetNameList(ref caseNameCount, ref caseNameArr);

            if (m_model.RespCombo.Add(loadcombination.Name, 0) == 0)
            {
                SetAdapterId(loadcombination, loadcombination.Name);
                foreach (Tuple <double, ICase> comboCase in loadcombination.LoadCases)
                {
                    double factor   = comboCase.Item1;
                    ICase  bhomCase = comboCase.Item2;
                    string caseName = "";

                    if (bhomCase.HasAdapterIdFragment(typeof(SAP2000Id)))
                    {
                        caseName = GetAdapterId <string>(bhomCase);
                    }
                    else if (caseNameArr.Contains(bhomCase.Name))
                    {
                        caseName = bhomCase.Name;
                    }
                    else
                    {
                        Engine.Base.Compute.RecordWarning($"case {bhomCase.Name} has no SAP2000_id, and no case with that name was found in the model. Try pushing the loadcase and using the result of that push to build the combo.");
                    }


                    if (m_model.RespCombo.SetCaseList(loadcombination.Name, ref nameType, caseName, factor) != 0)
                    {
                        Engine.Base.Compute.RecordWarning("Could not add case " + bhomCase.Name + " to combo " + loadcombination.Name);
                    }
                }
            }
            else
            {
                CreateElementError("Load Combination", loadcombination.Name);
            }

            return(true);
        }