Objects to workset using assembly code ( fails with system family(Types))



No addins please, need one simple click-to-run, compact package!

Elements which have assembly codes specified in the TYPES need to be on worksets that correspond to the first 3 characters of the assembly codes.

Can’t seem to get system families ‘TYPES’ / ‘Aseembly Code’ to comply with the gettype parameters- comes up as null. Tried a few ways. Tried PY, and notes and unwrapping other assemblies to no avail. PY included with the snapshots.

Also- Still need to find out how to transition the elements from one workset to another.

Having issues can’t seem to figure out the assembly codes for system families (or how to effectively tell which is system families and then take that alternate route to get the assembly codes… Any help is appreciated!



System Families obviously don’t have Family Types, but they do have Element Types. The nice thing is that Family Types seem to be under Element Types, so you just need to use Element.ElementType on your list of elements and it will return the Element Type or the Family Type respectively. Then you can get the Assembly Code from those.


Nice! That is part of it. Still learning the interface. Need to separate the elements from the family types.


You shouldn’t need to separate anything. Element.ElementType should work on all instances.


Assembly Code associated with Family type data but directly with system element data.


Correct. You still need to get the Family Type and Element Type from your list of family instances. Just look at the image from my first post.

Element.ElementType will return the Family Type for all Family Instances and the Element Type for all System Family Instances. You can get the Assembly Code value directly from both of these object types.


Didn’t work… See the red circle for all elements before it splits? Those should have been assembly codes. So I had to split the families to access the family types. Each element will have tp be on a workset- which is coming next : )


You’re still not using Element.ElementType. You need to use Element.ElementType between your list of elements and getting the assembly code value.

You can see in my list of elements that I have loadable families (AHUs and heaters) and system families (Floors and Walls).


Ah, much more streamlined thank you!


Home stretch- worksets won’t set.

Tried Name
Tried ID,
Tried passing workset- not working.


What is the error you’re getting on the Element.SetParameterByName node?


Warning: Element.SetParameterByName operation failed.
The best overloaded method match for ‘Revit.Elements.InternalUtilities.ElementUtils.SetParameterValue(Autodesk.Revit.DB.Parameter, double)’ has some invalid arguments

Updated upload:
Updated DYN 2017-12-15


Ah, the Workset ID’s object types are Autodesk.Revit.DB.WorksetId objects and not doubles (string an Object.Type node to your worsket output to see). You need to convert them to doubles and you’ll be all set :slight_smile:



Anyone Know if there is a cleaner way to convert a workset object/ID to a double?


Updated SOLUTION thanks to the folks who helped in this POST!:
Objects_to_worksets_from_assembly.dyn (41.1 KB)