Collect all categories in a project

Hi,

I dont know anything about this but has MaterialVolume seems plausible to me.
I know this is a field in the revit database exported using DBLink.

Marcel

I tried the HasMaterialQuantities property as well, but that will omit a lot of categories that are actually part of the model categories.

Now what if we wanted to save all these out to a folder?

Working through the solutions provided I am unable to find and access the RVT Links built-in category which (hopefully) would allow access to the reference Revit models in the project and begin creating associations across models. The warning in Dynamo is this:

Warning: Category.ByName operation failed. 
The selected category is not valid in this document.

I’m curious what would make a category ‘valid’ ? The only thing that comes to mind is that the underlying code of Revit disallows access to Revit Links through the API at this time. I realize the API can only go so far and hinges on what the engineers at Autodesk reveal to us common folk in the API.
Thoughts?

You can collect them.

in c# it is something like this:

        var linkColl= new FilteredElementCollector(DocumentManager.Instance.CurrentDBDocument);
        linkColl.OfClass(typeof(RevitLinkInstance));
        var elements = linkColl.ToElements();
1 Like

Oh wonderful that seems to be working for me! Thanks for helping get this off the ground for me John.

1 Like

Glad to help out!

Is there a way to select All of the Elements in the entire Project? I have tried feeding individual categories into List.Create as you have shown. I am concerned that this method is prone to user error if someone forgets to add all of the categories in the project. Additionally I noticed that there are many solutions that involve Python coding. I am new to Dynamo so I am difficulty understanding the posts that use long strings of Python code.


I am creating a script that calculates the volume of all of the Concrete in the entire building. I successfully created a script that can calculate the volume of all the elements on a specific floor. Instead of using “All Elements at Level” I’d like my script to be based on all Elements in the Project. Is it possible to do this without first learning Python coding?
Below is my functioning script, based on materials on a given level:

From the Sastrugi Package.

image
Please note that this gathers everything! (Model elements, Annotations, Styles etc) so may take a while to run on a larger project. Hope this helps :grinning:

1 Like

Hi everyone,
by the way, are there any node that we can collect all categories in linked model ?
or we have to code inside python script

Like this :

Get%20elements

4 Likes

Thanks @Alban_de_Chasteigner and Sastrugi Package :slight_smile:

1 Like

@erfajo You are correct as I used your coding as an inspiration for my intended purpose.

The intention of the node was “Big net, no holes” to catch all the :fish: for a total overview of project contents.
(I have a had quite a few projects where more data has been more helpful)

I see how the node name could cause some room for interpretation by the user, I appreciate the issue identification.:thinking: Perhaps a rename is required, from “Get All Elements in Project” to “Get Everything in Project” (will add this to the list for the next release)

I agree with the earlier postings by @erfajo and @T_Pover that show better targeted element extraction is essential to reduce graph complexity and run-times. :+1:

As always, I recommend that you (anyone reading this) check you are using the right tool for the job, in the right way. Any Q? the forum is always here :slight_smile:

1 Like

hello, I wish to get all categories of elements placed in a project without getting the elements list.

the package nodes that I see give a full list of built-in categories in the project but I just need to filter the exiting categories used in a project.

Thanks

It works this way but takes some time (About 2 minutes). Using all the info above (Thanks as always power users T_Pover, Konrad, etc… ) I got it to work (Did not delete room separations however lol). I am going to try to create some views and delete from those It might work faster. will keep you postedworking it out2.dyn (10.6 KB)

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
categories = doc.Settings.Categories

model_cat = []
anno_cat = []
ana_cat = []
internal_cat = []

for c in categories:
	if c.CategoryType == CategoryType.Model:
		if c.SubCategories.Size > 0 or c.CanAddSubcategory:
			model_cat.append(Revit.Elements.Category.ById(c.Id.IntegerValue))

	elif c.CategoryType == CategoryType.Annotation:
		if c.SubCategories.Size > 0 or c.CanAddSubcategory:
			anno_cat.append(Revit.Elements.Category.ById(c.Id.IntegerValue))
	
	elif c.CategoryType == CategoryType.AnalyticalModel:
		if c.SubCategories.Size > 0 or c.CanAddSubcategory:
			ana_cat.append(Revit.Elements.Category.ById(c.Id.IntegerValue))
	
	elif c.CategoryType == CategoryType.Internal:
		if c.SubCategories.Size > 0 or c.CanAddSubcategory:
			internal_cat.append(Revit.Elements.Category.ById(c.Id.IntegerValue))

OUT = model_cat, anno_cat, ana_cat, internal_cat
4 Likes

how to run that script from a list of Document Revit files instead of the Current document opened?7

Thanks

Read carefully :slight_smile:

Hello man, I hope everything is going well for you. Could you please explain to me how could I take out all the elements I have in my Revit model through nodes/python?
Moreover, I want to use them for taking out the quantity-takeoff and afterward for costing thus it would be better if you could be of any help in this domain too. Thanks

The most important part isn’t actually how to take the data out, it’s having the data set up well in the first place. From here a simple set of Element.GetParameterValueByName nodes can do the hard work. Most of the time this is where people will fail - they expect Dynamo/Revit to do all the hard work for them in setting a system up.

My suggested approach is to have at a type level:

  • The cost parameter populated as a rate (not overall cost unless it’s a unit cost)
  • An object code populated (keynote and/or type mark)
  • Elements assigned to suitable categories
  • A cost rate parameter indicated as text (ea/lm/m2/m3)
  • The corresponding measurement field for each cost rate should be present at an instance level in the element (Length/Area/Volume). If not, then you will need to include a shared parameter that houses that metric, and push a measurement into that field prior. For example if you measure a casework bench in m2, it will not have an Area parameter, but you could build a formula into your bench family to drive a shared parameter, or use Dynamo to measure the top surface area of its geometry then push it to that value.
  • You can use the cost rate to extract the respective value that drives the cost rate

Without that it’s pretty pointless getting all the elements in the model. I suggest only specifying the categories you wish to undertake takeoff for, don’t get all elements as many will be irrelevant such as Revit levels which can be seen in 3D.

All of this sounds like a lot of work, and it is. Time to roll the sleeves up!

There is a good example of this type of workflow here:

2 Likes

Hi everyone.
I have extracted all the quantities based on the project parameters I need in Excel by running the dynamo script category-wise. Now I want to filter the data within the categories at a first go and then I also want to make a summary by getting the for instance number of ‘glass’ doors and number of ‘wooden’ doors within one excel sheet because one category of ‘door’ extracts all the doors in one Excel file.

Secondly, how can I filter the one category data and summarize it. For example, in specialty equipment I have got the waste bins and washing machines and I want to separate them out within the similar sheet and then summarize them within the same sheet. e.g., no. of bins, no. of machines, etc

As I mentioned earlier, I want to make a category-wise summary in one sheet plus I want to make the overall elements of the project’s summary which look professionally aesthetic.

I thank you beforehand. If someone could help me out in this.
Good day.