Set "Workset" Parameter from Instance/Type Parameter?

Hi All,
I understand how we can “Get and Set Parameters by Name”……but can we “Get” an instance parameter and “Set” the Worksets Parameter in the Properties box?. My thinking is to properly clean up my family library and within each family create a parameter (e.g. Family workset) and populate it to read what workset this family should be on (e.g. 44 – SRV Fire).


Then load it (and all other relevant families) into a project and use a dynamo script to Get the information from “Family Workset” parameter created in the Family Mode, and populate all that information into the workset parameter which will correspond with the Worksets all ready available.


Basically I want all my families to be on the correct workset for visibility purposes. Some families have the same “categories” but might be required to be turned on or off in separate views. Thanks for your help.

You can use nodes from Archilab and Clockwork packages to do it.

In this example I set a type parameter for a family (but it can be also an instance parameter, in that case the workflow would be similar) as you suggested, and use this information to move the objects to the relative workset.

The question is: how do you populate the family parameter? I mean, what is the relation between the family and the “correct” workset? The category?

Let say we only use 100 electrical families in this company in any project. We have a local family directory that all modellors go to for our company families. Within each family (Family Mode) there is a Parameter I create called “Family Workset” or similar. I assign a workset name that aligns with our workset standards to this parameter manually for each one.

Later when I have completed my family directory, all modellors can load these families into any specific project and run a script to Get the information from this “Family Workset” parameter and set into the “Workset” parameter in the properties box.

Basically I want to do this to give more power to turning on/off worksets for visibility in Views. I feel restricted with using Categories… as an example…my Fire Alarm Panel is under Electrical equipment and not Fire Alarm Devices. So when I turn on Electrical Equipment to show Fire alarm devices I am showing more than I require.

That script although running clean did not populate my workset parameter…

I hope Im making sense

I might be wrong here, but the way it is in my head is as follows.
In a workshared project you have

  • model (3d) elements in a workset controlled by you
  • annotation (2d) elements in a view workset controlled by Revit
  • families in a family workset when edited and not relinguished yet controlled by Revit
  • and Project Standards worksets for line styles, object styles, and a lot of other settings controlled by Revit

This all to prevent multple users to edit the same object in the database at the same time until relinguished.

When a collegue edits a family it triggers the family workset to block other users to edit the family at the same time until released/relinguished.

Therefore editing the family workset is not advisable.

Can someone correct me if i’m wrong or incomplete?

So you have 2 phases:

A) Set for every family in your library a custom text parameter, called Workset Family, that indicate the correct workset to use for every specific family, when used in a project.

B) Run a script that reads the parameter and move the family to the correct workset.

This was clear since the beginning, what I showed is the way to perform phase B.

For phase A you need a batch process, that is opening all the families in the directory “Fire” and set parameter as “Fire”, “Water” and set “Water”, “Furniture” and set “Furniture”, …

You can probably use some nodes from Orchid Package:

Hi Luca,
The script on your first post…For me this creates a workset according to the name I create in the “Workset_Family” parameter…however it does not set the name in this parameter to match the that in the “Workset” parameter…Should this be the case ?

I have created a local Family folder with 7 families in it…The scripts works in that it creates a new parameter in all 7 called “Workset Family”…However there is an error in the “Document.close”…Also when I load these family into a project the “Workset_Family” is not there…Any thoughts why this might be please ?
Create Workset_Family Parameter.dyn (33.5 KB)

Your graph looks fine…
A reason for being read-only can be either it is read-only, or you try to run twice the graph after a breakdown. in the latter then the document is open in the background in advance!

The beginner mistake would be to open one of the families to be edited in the foreground, but I presume that you have not done that mistake.

I have moved one node so you will be able to count the number of files you have upgraded before passing on to deletion.

Create Workset_Family Parameter.dyn (35.7 KB)

1 Like

Hi all many thanks for your help…To solve the above issue I have to untick the “Read Only” tick box for all my families and this worked great…:slight_smile:

Next I want to assign a value to this parameter in all these .rfa files but I am having trouble with the ‘familytype’ … for example some families might have different categories…What nodes would fix this? …thanks in advances

The method also doable…

But I know I coded this not that long ago since I noticed the need for being able to feed nodes with both string values and data types. However, this is still something I work on implementing in all the applicable nodes and that will take some time. SetValue is in the current version (x.x.x.6905) able to take FamilyTypes.

Although, from your image to judge it looks like an impossible task to do. You are feeding my node with empty lists, and this will surely fail!

Many thanks for your assistance…could it work from the nodes below…I know its incomplete but haven’t had time yet to finish…

It should work… but it is very diffucult to know the details without the needed files. This is why it is required to upload the graph file and some sample files if needed.

However, I am not participating that much on the forum. If you think it is an error, then please follow the guidelines in my profile.

I have this script running without error…however it is not populating the parameter when I open up the family…Any ideas where I going wrong ? Thanks

03_Set Workset_Family Parameter to Family.dyn (39.2 KB)