Example #1
0
        /// <summary>
        /// CheckGroups - check all groups of elements, put GrType.Warning if group is incorrect
        /// </summary>
        /// <param name="groups"></param>
        public void CheckGroups(ref Model.Model mod)
        {
            if (mod == null || mod.elements == null || mod.elements.Count < 1 ||
                mod.elmGroups == null || mod.elmGroups.Count < 1 ||
                mod.elements.Count != mod.elmGroups.Sum(x => x.guids.Count))
            {
                Msg.F(me + "ChechGroup bad model", mod.name);
            }
            var _dic = mod.elements.ToDictionary(x => x.guid);

            foreach (var gr in mod.elmGroups)
            {
                elmsDic = _dic.Where(x => gr.guids.Contains(x.Value.guid)).ToDictionary(v => v.Key, v => v.Value);
                Mat     = elmsDic.First().Value.mat;
                int  grIndex = mod.elmGroups.IndexOf(gr);
                bool errFlag = false;
                foreach (var elm in elmsDic)
                {
                    if (elm.Value.mat == Mat)
                    {
                        continue;
                    }
                    mod.elmGroups[grIndex].type = GrType.Warning;
                    mod.HighLightElements(elmsDic);
                    if (errFlag)
                    {
                        continue;
                    }
                    Msg.W(me + "CheckGroups various materials in Group"
                          , grIndex, gr.Prf, Mat, elm.Value.mat);
                    errFlag = true;
                }
            }
        }
Example #2
0
 /// <summary>
 /// Str(SType stype) - return Sec stype of Component for Viewer
 /// </summary>
 /// <param name="stype">SType Section of Component representation</param>
 /// <returns>representation of Component as a string</returns>
 public string Str(SType stype)
 {
     if (!compDP.dpStr.ContainsKey(stype))
     {
         if (stype == SType.Price)
         {
             throw new KeyNotFoundException();
         }
         Msg.W("CompSet wrong LoadDescriptor", stype);
         return(string.Empty);
     }
     return(compDP.dpStr[stype]);
 }
Example #3
0
 public Supplier(string _name, bool init=true)
 {
     Name = _name;
     if (!init) return;
     Docs docSupl = Docs.getDoc(Decl.SUPPLIERS);
     for (int i = docSupl.i0; i <= docSupl.il; i++)
     {
         string suplName = docSupl.Body.Strng(i, Decl.SUPL_NAME);
         if (suplName != _name) continue;
         getSupplier(i);
         return;
     }
     Msg.W("No such Supplier(" + _name + ")");
 }