Exemple #1
0
        public void AddElement(string name, double vol, string revitMaterial, Document doc, BuiltInCategory cat)
        {
            RevitMaterial matToAssign     = null;
            string        materialToMatch = revitMaterial;
            var           revMat          = RevitMaterials.Where(a => a.Name == materialToMatch);

            if (revMat.Count() == 0)
            {
                matToAssign = new RevitMaterial(revitMaterial, this);
                RevitMaterials.Add(matToAssign);
            }
            else
            {
                matToAssign = revMat.First();
            }

            RevitCategory catToAssign = null;
            string        nameToMatch = Category.GetCategory(doc, cat).Name;
            var           revCat      = Categories.Where(a => a.Name == nameToMatch);

            if (revCat.Count() == 0)
            {
                catToAssign = new RevitCategory(doc, cat, this);
                Categories.Add(catToAssign);
            }
            else
            {
                catToAssign = revCat.First();
            }

            Elements.Add(new ElementCarbonVM(name, vol, matToAssign, catToAssign, this));
        }
 public ElementCarbonVM(string name, double vol, RevitMaterial mat, RevitCategory cat, MaterialsVM parent)
 {
     _name          = name;
     _volume        = vol;
     _revitMaterial = mat;
     _category      = cat;
     _parent        = parent;
     _iceMat        = new ICEMaterialNone(this);
 }