Exemplo n.º 1
0
        private static SAPLoadCombination[] GetLoadCombinationsList()
        {
            SAPLoadCombination[] combos;
            int noCombos = 0;

            string[] names = new string[1];
            int      flag  = mySapModel.RespCombo.GetNameList(ref noCombos, ref names);

            if (flag != 0)
            {
                return(null);
            }
            else
            {
                combos = new SAPLoadCombination[noCombos];

                for (int i = 0; i < noCombos; i++)
                {
                    combos[i]      = new SAPLoadCombination();
                    combos[i].Name = names[i];
                    bool comboFlag = GetLoadCombinationCases(combos[i].Name, out combos[i].loadCases, out combos[i].loadCombos, out combos[i].loadCasesFactors, out combos[i].loadCombosFactors);
                    combos[i].IsDefinedInSAP = true;
                    if (comboFlag == false)
                    {
                        throw new Exception("Couldn't retrieve combo cases");
                    }
                }
            }
            return(combos);
        }
Exemplo n.º 2
0
        public static SAPLoadCombination[] GetAllLoadCombinations()
        {
            int noResults = 0;

            string[]             names  = new string[1];
            SAPLoadCombination[] combos = null;
            int flag = mySapModel.RespCombo.GetNameList(ref noResults, ref names);

            if (flag != 0)
            {
                //Failed to retrieve the combinations
                return(null);
            }
            else
            {
                combos = new SAPLoadCombination[noResults];
                for (int i = 0; i < noResults; i++)
                {
                    combos[i]                = new SAPLoadCombination();
                    combos[i].Name           = names[i];
                    combos[i].IsDefinedInSAP = true;
                    combos[i].LoadCases      = null; //TODO Get load cases
                    combos[i].LoadCombos     = null; //TODO Get load cases
                }
            }
            return(combos);
        }
Exemplo n.º 3
0
        public static bool DesignSteelModel(string codeName, SAPLoadCombination deflectionCombo, SAPLoadCombination strengthCombo, bool ToChangeSections, IEnumerable <SAPFrameElement> elements, ref SAPDesignStatistics statistics)
        {
            //Setting Design combinations
            int flag = mySapModel.DesignSteel.SetComboDeflection(deflectionCombo.Name, true);

            flag = mySapModel.DesignSteel.SetComboStrength(deflectionCombo.Name, true);
            if (flag != 0)
            {
                return(false);
            }
            else
            {
                return(DesignSteelModel(codeName, ref statistics, ToChangeSections, elements));
            }
        }
Exemplo n.º 4
0
        public static bool AddLoadCombination(SAPLoadCombination comb)
        {
            int flag = mySapModel.RespCombo.Add(comb.Name, (int)comb.CombType);//Adding a new combination

            if (comb.LoadCases != null)
            {
                for (int i = 0; i < comb.LoadCases.Count; i++)
                {
                    eCNameType type     = eCNameType.LoadCase;
                    string     caseName = comb.LoadCases[i].Name;
                    if (comb.LoadCases[i].IsDefinedInSAP == false)
                    {
                        //AddLoadCase(); //TODO
                    }
                    float scaleFactor = comb.LoadCasesFactors[i];
                    mySapModel.RespCombo.SetCaseList(comb.Name, ref type, caseName, scaleFactor);//Adding defined load cases to the combination
                }
            }


            if (comb.LoadCombos != null)
            {
                for (int i = 0; i < comb.LoadCombos.Count; i++)
                {
                    eCNameType type      = eCNameType.LoadCombo;
                    string     comboName = comb.LoadCombos[i].Name;
                    if (comb.LoadCombos[i].IsDefinedInSAP == false)
                    {
                        AddLoadCombination(comb.LoadCombos[i]);
                    }
                    float scaleFactor = comb.LoadCombosFactors[i];
                    mySapModel.RespCombo.SetCaseList(comb.Name, ref type, comboName, scaleFactor);//Adding defined load combos to the combination
                }
            }
            if (flag != 0)
            {
                comb.IsDefinedInSAP = false;

                return(false);
            }
            comb.IsDefinedInSAP = true;
            return(true);
        }
Exemplo n.º 5
0
        private static bool GetLoadCombinationCases(string comboName, out List <SAPLoadCase> loadCases, out List <SAPLoadCombination> loadCombos, out List <float> loadCasesFactors, out List <float> loadCombosFactors)
        {
            loadCases  = new List <SAPLoadCase>();
            loadCombos = new List <SAPLoadCombination>();

            loadCasesFactors  = new List <float>();
            loadCombosFactors = new List <float>();

            int noComponents = 0;

            string[]     names   = new string[1];
            eCNameType[] types   = new eCNameType[1];
            double[]     factors = new double[1];
            int          flag    = mySapModel.RespCombo.GetCaseList(comboName, ref noComponents, ref types, ref names, ref factors);

            if (flag != 0)
            {
                loadCases  = null;
                loadCombos = null;
                return(false);
            }
            else
            {
                for (int i = 0; i < noComponents; i++)
                {
                    if (i >= types.Count())
                    {
                        continue;
                    }
                    switch (types[i])
                    {
                    case eCNameType.LoadCase:
                        SAPLoadCase Case = new SAPLoadCase();
                        Case.Name           = names[i];
                        Case.IsDefinedInSAP = true;
                        loadCases.Add(Case);
                        loadCasesFactors.Add((float)factors[i]);
                        break;

                    case eCNameType.LoadCombo:
                        SAPLoadCombination combo = new SAPLoadCombination();
                        combo.Name           = names[i];
                        combo.IsDefinedInSAP = true;
                        bool comboFlag = GetLoadCombinationCases(combo.Name, out combo.loadCases, out combo.loadCombos, out combo.loadCasesFactors, out combo.loadCasesFactors);
                        if (comboFlag == false)
                        {
                            throw new Exception("Couldn't retrieve combo cases");
                        }
                        else
                        {
                            loadCombos.Add(combo);
                            loadCombosFactors.Add((float)factors[i]);
                        }
                        break;

                    default:
                        break;
                    }
                }
                return(true);
            }
        }