Hi all. I'm trying to get all door elements from project. But some interesting thing happens. I removed all elements except the problem wall. When I try to get list of door with:
FilteredElementCollector col = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors);
there are two doors poping out. If you look in 3d view there are no any doors. I got one of doors ID and searched for it with "Select By ID". Revit couldn't find an appropirate view to show it. But if you hit OK it selects and shows its properties.
Have you faced with such problem? How can I exclude them from my door list?
I attached revit file below.
Solved! Go to Solution.
Hi all. I'm trying to get all door elements from project. But some interesting thing happens. I removed all elements except the problem wall. When I try to get list of door with:
FilteredElementCollector col = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors);
there are two doors poping out. If you look in 3d view there are no any doors. I got one of doors ID and searched for it with "Select By ID". Revit couldn't find an appropirate view to show it. But if you hit OK it selects and shows its properties.
Have you faced with such problem? How can I exclude them from my door list?
I attached revit file below.
Solved! Go to Solution.
Solved by nur91m. Go to Solution.
I assume that the door you are after is a family instance.
Every family instance is associated with a family symbol.
Your filtered element collector is returning both.
The easiest way to filter out all the symbols in this simple case is to add a call to WhereElementIsElementType to your filter:
https://apidocs.co/apps/revit/2019/77793daa-5a26-b4d6-9019-4d998a55099e.htm
More important is to understand why this is happening.
These kind of very basic questions are covered in the Revit API getting started material:
https://thebuildingcoder.typepad.com/blog/about-the-author.html#2
Maybe you ought to work through that before asking any further basic questions.
Also, the Revit API will present you with many further surprises like if you do not understand the Revit product from a user interface point of view.
It would help to learn a bit about the product itself and its BIM paradigm before starting to work on programming it.
Best regards,
Jeremy
I assume that the door you are after is a family instance.
Every family instance is associated with a family symbol.
Your filtered element collector is returning both.
The easiest way to filter out all the symbols in this simple case is to add a call to WhereElementIsElementType to your filter:
https://apidocs.co/apps/revit/2019/77793daa-5a26-b4d6-9019-4d998a55099e.htm
More important is to understand why this is happening.
These kind of very basic questions are covered in the Revit API getting started material:
https://thebuildingcoder.typepad.com/blog/about-the-author.html#2
Maybe you ought to work through that before asking any further basic questions.
Also, the Revit API will present you with many further surprises like if you do not understand the Revit product from a user interface point of view.
It would help to learn a bit about the product itself and its BIM paradigm before starting to work on programming it.
Best regards,
Jeremy
Hi Jeremy. Thank you for your reply. I've used Revit for 5-6 years and I think that I have enough experience working with Revit. Maybe I don't ))
Of course I'm using WhereElementIsElementType after that filter. I showed that code just for example. Ok this is from my actual code. I have N_BuiltInCategoryService class which has static property. The static property is a list of BuiltInCategory. What I'm trying is to get family instances which belongs to that categories.
var builtInParameter = Enum.GetValues(typeof(BuiltInCategory)); elementsByCategory = new Dictionary<BuiltInCategory, List<Element>>(); foreach (BuiltInCategory cat in N_BuiltInCategoryService.builtInCategory) { FilteredElementCollector col = new FilteredElementCollector(doc).OfCategoryId(new ElementId(cat)); col = col.WhereElementIsNotElementType(); if (elementsByCategory != null && !elementsByCategory.ContainsKey(cat)) elementsByCategory.Add(cat, col.ToList()); }
Then I found some extra doors, windows, curtain panels which was in CURTAIN WALLS. This thing is happening only with elements which was put in the curtain wall. In the attached file there are two phantom doors which have these IDs 1919943, 3493517. And they are NOT FamilySymbol neither Family type. They are FamilyInstance type.
I made experiment with divisions of curtain wall. If delete first horizontal division from bottom then door with ID 3493517 removes from project DB. And it means door was in the curtain wall. but not visible and selectable.
Then I tried to get that door from quantity schedule of doors but Revit shows nothing.
How do you think why this is happening?
Hi Jeremy. Thank you for your reply. I've used Revit for 5-6 years and I think that I have enough experience working with Revit. Maybe I don't ))
Of course I'm using WhereElementIsElementType after that filter. I showed that code just for example. Ok this is from my actual code. I have N_BuiltInCategoryService class which has static property. The static property is a list of BuiltInCategory. What I'm trying is to get family instances which belongs to that categories.
var builtInParameter = Enum.GetValues(typeof(BuiltInCategory)); elementsByCategory = new Dictionary<BuiltInCategory, List<Element>>(); foreach (BuiltInCategory cat in N_BuiltInCategoryService.builtInCategory) { FilteredElementCollector col = new FilteredElementCollector(doc).OfCategoryId(new ElementId(cat)); col = col.WhereElementIsNotElementType(); if (elementsByCategory != null && !elementsByCategory.ContainsKey(cat)) elementsByCategory.Add(cat, col.ToList()); }
Then I found some extra doors, windows, curtain panels which was in CURTAIN WALLS. This thing is happening only with elements which was put in the curtain wall. In the attached file there are two phantom doors which have these IDs 1919943, 3493517. And they are NOT FamilySymbol neither Family type. They are FamilyInstance type.
I made experiment with divisions of curtain wall. If delete first horizontal division from bottom then door with ID 3493517 removes from project DB. And it means door was in the curtain wall. but not visible and selectable.
Then I tried to get that door from quantity schedule of doors but Revit shows nothing.
How do you think why this is happening?
Thank you for clarifying and congratulations on your Revit experience. You certainly have more than I do, then 🙂
Sorry, in that case I have no idea where your weird doors are coming from.
I would clean the model rigorously if I were you before it explodes.
Cheers,
Jeremy
Thank you for clarifying and congratulations on your Revit experience. You certainly have more than I do, then 🙂
Sorry, in that case I have no idea where your weird doors are coming from.
I would clean the model rigorously if I were you before it explodes.
Cheers,
Jeremy
I did experiments with the model. I opened files with Revit 2017, 2018, 2019 versions. Revit 2017, 2018 versions couldn't show that phantom doors in Door Schedule, but Revit 2019 shows them as my code does.
Well, it's definitely bug of 2017, 2018 versions that they are not shown in schedule. But there's another problem, Revit stores FamilyInstance which is not visible, editable and with not proper parameter values in project DB.
I did experiments with the model. I opened files with Revit 2017, 2018, 2019 versions. Revit 2017, 2018 versions couldn't show that phantom doors in Door Schedule, but Revit 2019 shows them as my code does.
Well, it's definitely bug of 2017, 2018 versions that they are not shown in schedule. But there's another problem, Revit stores FamilyInstance which is not visible, editable and with not proper parameter values in project DB.
Can't find what you're looking for? Ask the community or share your knowledge.