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

revit
python
dynamo

#1

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!


~TIA!


#2

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.


#3

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


#4

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


#5

Assembly Code associated with Family type data but directly with system element data.
aSSEMBLY CODE ASSOCIATED WITH fAMILY TYPE DATA BUT DIRECTLY WITH sYSTEM ELEMENT DATA.


#6

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.


#7

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 : )


#8

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).


#9

Ah, much more streamlined thank you!


#10

Home stretch- worksets won’t set.

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


#11

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


#12

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


#13

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:


#14

Thanks!

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


#15

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