Canguro.Model.Design.DesignOptions.AddCombination C# (CSharp) Method

AddCombination() protected method

protected AddCombination ( string name, LoadCase types, float factors ) : void
name string
types Canguro.Model.Load.LoadCase
factors float
return void
        protected void AddCombination(string name, LoadCase.LoadCaseType[] types, float[] factors)
        {
            foreach (AbstractCase ac in Model.Instance.AbstractCases)
                if (ac.Name.Equals(name))
                {
                    if (ac is LoadCombination)
                        designCombinations.Add((LoadCombination)ac);
                    return;
                }

            LoadCombination combo = new LoadCombination(name);
            for (int i = 0; i < types.Length; i++)
            {
                float factor = 1;
                if (factors.Length > i)
                    factor = factors[i];
                List<AbstractCaseFactor> loads = GetLoads(types[i], factors[i]);
                if (loads.Count > 0)
                    combo.Cases.AddRange(loads);
                else
                    return;
            }
            if (combo.Cases.Count > 0) designCombinations.Add(combo);
        }