Set Workset By System Type-Pipe


I am trying to create script to set workset for pipes based on their “System Type”. I have created attached script and it’s running fine without any error with attached Revit file but workset is not changing.

Following are the list of Worksets and System Type i like to match.

XS CAD Chilled Water Flow - Hyd_Water
XS CAD Fire Booster - Fire
XS CAD Sanitary Drain - Hyd_Sewer

I really appreciate any help on this.

Set Workset By System Type-Pipe.dyn (15.1 KB)

thanks for updating the file. Would you please update a screenshot too ?
Am sure you will get more help in this way.

Here are the screenshot of Dynamo script and Revit model.

You can see that even after running the script selected pipes workset is still “Workset1”

Cheers, but the nodes` title are not legible…
In any case, have a look to this, may be useful.

Hey Simoneavellini,

Thank you once again. This is good script but this will manual task where i need to select the elements.

What i am trying to achieve is that dynamo finds the pipes based on their system types and put them into specific Worksets.

Suggest if above script is possible or what is wrong with my script please.

Here is the attached another screen with visible nodes name.

Nitesh Panchal

You need to somehow map the system type to the workset id. Right now you’re setting the workset as the system type (which doesn’t exist and is the wrong type.) I would use a dictionary to map each system type to the appropriate workset id.

Hi Nick,

Thank you for your help and script is alive using workset id node you suggested.

Now i have one more query that i like to search more items using system type and i have used “String.Contains” node. Here i like to assign list of string to be search in selected items. Any suggestion what is the right node for the same.

Hi Nick,
could you provide an example of using a dictionary in this instance. I understand the concept, but dont know how to execute.
thank you

Hey Nick,

Thank you for your email. FYI - I have resolved this issue and it is working fine for me now.

1 Like

this makes total sense! thank you!

One quick follow up, I realize this is an example, but do I have to extract the workset ID and bind in the dictionary definition, or does this let me set what the ID is no matter what is already in revit?

Many thanks again!

You would have to extract the IDs from the worksets in your project.

Perfect! I’ll share my final script for everyone when I complete it.