コード例 #1
0
        /***************************************************/
        /**** Private methods                           ****/
        /***************************************************/
        private bool CreateObject(LoadCombination bhLoadCombo)
        {
            int err;
            int uID            = 1;
            int loadCaseType   = St7.ltLoadCase;
            int freedomCaseNum = 1;
            int loadComboId    = GetAdapterId <int>(bhLoadCombo);

            List <Loadcase> allLoadCases = ReadLoadcase();
            var             comparer     = new BHoMObjectNameOrToStringComparer();

            err = St7.St7AddLSACombination(uID, bhLoadCombo.Name);
            if (err != St7.ERR7_NoError)
            {
                err = St7.St7SetLSACombinationName(uID, loadComboId, bhLoadCombo.Name);
                if (!St7ErrorCustom(err, "Could not create or update a load combination number " + loadComboId))
                {
                    return(false);
                }
            }
            foreach (Tuple <double, ICase> tuple in bhLoadCombo.LoadCases)
            {
                Loadcase ldcas    = allLoadCases.Where(x => x.Number == (tuple.Item2 as Loadcase).Number).FirstOrDefault();
                int      lCaseNum = ldcas.Number;
                // int lCaseNum = GetAdapterId<int>(ldcas);
                err = St7.St7SetLSACombinationFactor(uID, loadCaseType, loadComboId, lCaseNum, freedomCaseNum, tuple.Item1);
                if (!St7ErrorCustom(err, "Could not set load case " + lCaseNum + " factor for a load combo " + loadComboId))
                {
                    return(false);
                }
            }
            return(true);
        }