Requesting Best Practices for Extracting Worksets of Elements in Dynamo

Hi everyone,

I’m currently using a Dynamo workflow to extract the Workset information of multiple categories (Walls, Doors, Windows) and export it to Excel. Here’s a quick summary of my current process:

  1. I use All Elements of Category nodes for each category.
  2. I combine them using List.Create and List.Flatten.
  3. Then I extract the Element.Workset and Element.Name.
  4. Finally, I export everything using Data.ExportToExcel.

It works fine, but I want to ask the community:

:backhand_index_pointing_right: Are there any better practices or more efficient methods to extract Workset data in Dynamo?
:backhand_index_pointing_right: Would using Python (or a specific custom package) be more reliable for large models or linked elements?

I’d really appreciate any expert insights, especially for large-scale projects or ISO 19650-compliant workflows.

Thanks in advance!


DYN-24_EXTRACTING WORSET & EXPORT TO EXCEL.dyn (39.6 KB)

Python would be slightly more efficient to avoid sending lists in/out of custom nodes that probably iterate in two stages vs one.

Without using Python your approach is about as efficient as I’d say you can get.

1 Like

Hey,

Here’s a slightly different method with a few different nodes, also with its ‘node to code’ version (select nodes, right click).

Hope that’s of interest,

Mark

1 Like

Your graph is good as is - I’d push to production alraedy. There are some gains, but they’re minimal (the graph runs in 600ms without optimizing, but we can get it to 500ms if we move to Python, or 200ms if we move to a zero touch node or even 20ms if we mvoe to an add-in… but you’re talking fractions of a fraction of a second… It’s at the point where realistically you’ll never recoup the time you spend making it ‘better’ as there isn’t enough gain in real production terms.

That said, learning ‘faster’ from simple examples like this will help with the ones where efficiency gains are a must, so I’ll weigh in with my thoughts.

This is good, but better would be to make a list of categories and pass that onto one All Elements Of Category node as it decreases the number of nodes and thereby memory consumption.

If you maintain the many all elemetns of category, try a List.Join in place of the List.Create, with no need for the List.Flatten. if you do move into a list of categories into the all elements of category keep the List.Flatten but delete the List.Create. Likely best to move the flatten to later in the process if you don’t have more data than just the workset names though - after the Workset.Name or after my next recommendation.

GeniusLoci has a node for pulling the workset name directly from the element along with the workset - you’ll get some performance gains here as @GavinCrump mentioned.

You can query the name of the model as the sheet name, or the file name. Document.Current and some file system/string manipulation should help there. You might also consider adding a heading to the content. Or the element id or class of the element you pulled the workset from - I don’t see much value in just having a series of workset names in sequence right now, but I’m not in the loop on your BXP. CSV is also better from a portability standpoint. or JSON. or anything other than Excel really. Unless you’ve it to read the data, not maintain it unless you’ve got formulas in there.

My version via nodes:

3 Likes

Thanks a lot, @GavinCrump — really appreciate you weighing in :folded_hands:
Appreciate your time and guidance! I love all your Youtube tutorials :slight_smile:

1 Like

Thanks a ton, @jacob.small :folded_hands:

This explanation helped me immensely — not just with refining this workset extraction workflow, but with understanding when and why not to over-optimize in Dynamo. That “fractions of a second” perspective really put things in balance for me.

Thanks again for sharing not just the technical fix but the thinking behind it. That’s what really helped me level up. :raising_hands:

1 Like

Glad you’re in a good spot!

1 Like