示例#1
0
        public List <TargetWalls> GetAllWalls(List <Document> documents, List <Level> levels)
        {
            List <TargetWalls> list = new List <TargetWalls>();

            foreach (Document doc in documents)
            {
                FilteredElementCollector collector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls);
                foreach (Element element in collector)
                {
                    TargetWalls tWall = new TargetWalls();
                    tWall.element = element;
                    foreach (Parameter param in element.Parameters)
                    {
                        if (param.Definition.Name.Contains("Description"))
                        {
                            // MessageBox.Show(param.AsString());
                            tWall.material = param.AsString();
                        }

                        if (param.Definition.Name.Contains("Brandschutzanforderungen") && !string.IsNullOrEmpty(param.AsString()))
                        {
                            tWall.fireRate = param.AsString();
                        }
                    }
                    list.Add(tWall);
                }
            }
            return(list);
        }
        private void AddParameterData(Document doc, List <FamilyInstance> devices, TargetWalls wall)
        {
            using (Transaction trans = new Transaction(doc, "Adding Parameter"))
            {
                trans.Start();

                foreach (FamilyInstance instance in devices)
                {
                    Parameter material = instance.LookupParameter("WandTyp");
                    material.Set(wall.material);
                }
                trans.Commit();
            }
        }
        private List <TargetWalls> GetAllWalls(List <Document> documents)
        {
            List <TargetWalls> list = new List <TargetWalls>();

            foreach (Document doc in documents)
            {
                FilteredElementCollector collector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls);
                foreach (Element element in collector)
                {
                    TargetWalls tWall = new TargetWalls();
                    tWall.element = element;
                    foreach (Parameter param in element.Parameters)
                    {
                        if (param.Definition.Name.Contains("IfcMaterial"))
                        {
                            tWall.material = param.AsString();
                        }
                    }
                    list.Add(tWall);
                }
            }
            return(list);
        }