Ejemplo n.º 1
0
        private static List <Element> recursiveElements(Document doc, Category cat)
        {
            List <Element>  elements = new List <Element>();
            List <Category> subCat   = CategoriesMapper.getSubCategories(doc, cat);

            if (subCat != null)
            {
                foreach (Category subCategory in subCat)
                {
                    //The recursion
                    var subElem = recursiveElements(doc, subCategory);
                    elements.AddRange(subElem);
                }
            }

            FilteredElementCollector collector    = new FilteredElementCollector(doc);
            List <Element>           thisElements = collector.OfCategoryId(cat.Id)
                                                    .WhereElementIsNotElementType()
                                                    .ToElements()
                                                    .ToList();

            elements.AddRange(thisElements);

            return(elements);
        }
Ejemplo n.º 2
0
        public ElementToWorkest(Document doc)
        {
            this.doc              = doc;
            this.worksetMapper    = WorksetMapper.getMapper(doc);
            this.categoriesMapper = CategoriesMapper.getMapper(doc);

            InitializeComponent();
            InitializeElements();
            InitializeWorksets();
        }