Select all elements in Revit file

Hello Everyone!
How can I select all elements in current Revit file using dynamo nodes or maybe packages?

Then (optional), how can I exclude any categories from selection.

Hello @wolfynys …and welcome…something here could probably work for you…

1 Like

Be careful because there is going to be a whole lot of stuff in “EVERYTHING” that you probably don’t expect. It would probably be safer depending on what the goal is to select by category vs filter by category…

3 Likes

Yes Sean true :wink:

1 Like

@sovitek has provided a solution to what you asked for @wolfynys, my comment is more about process.

1 Like

The goal is to select as much as possible in model and delete it excluding openings, walls and floors.

To coordinate with MEP engineers we need a solution to make the smallest possible size of file.
That would not be a central model in future.

To select all categories excluding mentioned would be the best solution?

1 Like

Ah, in that case I think you are on the right path, and if you use what @sovitek showed inside a 3D view it should get you very close. I assume you only want to remove Model elements and not Families and Styles etc?

1 Like

Yes there are many questions here…think Orchid and Datashapes there can collect all in project…

Curious to why this is a goal. Wouldn’t MEP engineers will likely want to see stuff like the kitchen counters so that they can put the under cabinet lighting in correctly? Or the location of the toilet in the room? What is preventing the mechanical engineer from placing a heat pump in a ceiling feature?

1 Like

anyway…Nice to hear an architect try to please an mep guy :wink: :wink:

1 Like

Absolutely right!
But we design structural discipline and that’s the only categories MEP engineers need to see in my opinion… Just thoughts :slightly_smiling_face:

Ah! I would keep columns, beams and all structural framing too in that case. Otherwise all those sprinkler pipes are going to be place in just the worst possible place… because of course. Levels and Grids should also likely remain, alignment purposes if nothing else. You will also need to keep at least one view.

I think building up a list of categories to clean and wiring that into an ‘all elements of category’ node, and feeding that into an element.delete node should do the trick. You will need to use the purge node as the last item in the string (new in 21 or 22 I think), or manually purge the file once done to reduce the file size to the max.

1 Like

Yes, I think that probably would be the best available solution for that moment. Thank you!

This will select everything in Revit - but you will be getting stuff you cant see or touch.
It can be useful if you then want to filter that down.

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = uiapp.ActiveUIDocument

from System.Collections.Generic import List

myRooms = uidoc.Selection.GetElementIds()

myView = doc.ActiveView.Id

mySelection = FilteredElementCollector(doc).WhereElementIsNotElementType().ToElementIds()

uidoc.Selection.SetElementIds(mySelection)
myResult = mySelection

Add a view and you’ll have everything in the current view.

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = uiapp.ActiveUIDocument

from System.Collections.Generic import List

myData = UnwrapElement(IN[0])
myRooms = uidoc.Selection.GetElementIds()

myView = doc.ActiveView.Id

mySelection = FilteredElementCollector(doc, myView).WhereElementIsNotElementType().ToElementIds()

uidoc.Selection.SetElementIds(mySelection)
myResult = mySelection