Getting worksets Name

Morning guys,
i’m trying to do something simple. Im puling all the detail components and i want to sort them by worksets. The ID works fine but i want to get the name of those worksets.
Workset.Name from Archi-Lab returns a (No function called %get_Named…) and Element.Parameters.
Seems like there was a node caleld Get Worksets at some point but i can’t track it. Will i need a custom node?

Thanks

1 Like

Hi @Daniel_Hurtubise ,
you can get it with this little bit of code:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*

if isinstance(IN[0],list):
	OUT = [i.Name for i in IN[0]]
else:
	OUT = IN[0].Name
16 Likes

So no way without a custom node right?
Thanks a lot for your help, that works like a charm by the way :slight_smile:

It appears so …
You’re most welcome :slight_smile:

@Mostafa_El_Ayoubi, @Daniel_Hurtubise:

you just need to create a filtered collector that select the “UserWorkset” type (vs. all worksets)

with one line of code you can pull the names of the worksets, no need for custom node.

ws_n = [i.Name for i in FilteredWorksetCollector(doc).OfKind(WorksetKind.UserWorkset]

Perfect, just what I needed!

1 Like

Thanks Mostafa !