Issue Exporting Workset

I’m working on a script to export a few variables to excel. My test file is just a grid of 3x4 electrical j-boxes with a couple of variables.

I got it to successfully export the family name and phase to excel:

But when I try doing the same thing with worksets dymamo get’s lost. To make it even more confusing, when I use a different node to look at what parameters it can look for workset is on the list.

image

Am I missing something obvious?

The Parameter object shows the parameter name and user-facing value (the visible value). The parameter value in this case is actually an element (the workset element) and returns the element id. You’ll have to convert the workset id to the element so you can get the name that way.

Or you could use something like GetParameterAsValueString from MEPover to get the string value.

To rephrase what @Nick_Boyts said, value 0 might be the “Shared Levels and Grids” workset.
Hope you dont mind @Nick_Boyts

Don’t mind at all. And just for future reference a 0 or -1 element id usually refers to a Revit default value. Probably Workset1 in this case.

Thanks to both of you. Unfortunately I’m still a little lost. I got it to extract the element Id but I don’t know how to convert it back to the element part I want. I also tried it with element.getparametervaluebyname with no luck.

Also, I can’t use the MEPover package for this because I’m making this for someone else (who’s remote) and I don’t trust them to tie their shoes much less download a package so I’m stuck with dynamo default stuff at the moment.

P.S. You’re correct that these are just workset1 at the moment.

You’ll have to use Python if you aren’t using custom packages.
image

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

dataEnteringNode = IN
elements = UnwrapElement(IN[0])
OUT = [element.LookupParameter("Workset").AsValueString() for element in elements]

Thank you so much. You’re a genius. Next rounds on me :beers: