I want to get names of the worksets that are toggled (active or visible) from linked file in a given view.
The setting i’m referring to is shown below
I did of course searched the forum and the whole internet for how to do this. From what I’ve learned, it’s impossible to change the parameters because of the API. But is there a way to read the values… that’s what I urgently need to know
I think this can do the trick:
I’d really like to think so, unfortunately I’m not sure it’s possible with a Link
So to get a Workset’s visibility from a view, the method I’m aware of is…
Which requires a Workset Id…
‘WorksetId is not guaranteed to be unique. It is only valid within one model and its value may change when the model is synchronized with central. If unique identification of a workset is needed, the workset’s GUID should be used instead.’
If I try and feed a GUID, I get…
So, unless there is a get linked Workset visibility property/method somewhere, I don’t think it works…
My bad, didn´t read the full title, it states linked.
Makes sense what you said, but in case the method works with a linked model and if the workset id changes he would have to run the script again to get the update values, right?
A bit late here, will experiment with this tomorrow.
Thanks for the info!
Hah, I think you’re right
The numbering seems to include all the linked worksets too!
Still might be a bit flaky, and needs some work, but it does get a result…
I’m noob what goes about python. Can you please share the code?
I butchered a bit of clockwork code in a shameful way…
#thanks to Clockwork!
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
inputdoc = UnwrapElement(IN)
if inputdoc == None:
doc = DocumentManager.Instance.CurrentDBDocument
elif inputdoc.GetType().ToString() == 'Autodesk.Revit.DB.RevitLinkInstance':
doc = inputdoc.GetLinkDocument()
elif inputdoc.GetType().ToString() == 'Autodesk.Revit.DB.Document':
doc = inputdoc
else: doc = None
collector = FilteredWorksetCollector(doc)
list = collector.ToWorksets()
wrksetId = 
lnkViewWrkSetVis = 
output = 
inputView = UnwrapElement(IN)
for l in list:
listId = l.Id
wks = 
if l.Kind == WorksetKind.UserWorkset:
name = l.Name
vis = inputView.GetWorksetVisibility(listId)
visdef = l.IsVisibleByDefault
uGSet = WorksetVisibility.UseGlobalSetting
if vis == uGSet and visdef == True:
visOut = 'Visible' # True
elif vis == uGSet:
visOut = 'Visible' # True
visOut = 'Hidden' # False
OUT = output
Thank you, but it gives me an error:
Hey, something went wrong with the formatting when I posted it, I’ve updated now… The error is if you don’t have your indents correctly set…
I’ve updated the code to only output User worksets, this seems consistant with your screen grab? Otherwise you get millions of them
I’ve also done a bit of filtering and outputted whether visible…
Hope that helps,
Thank you very much for the effort but unfortunately it doesn’t work…
To be clear, I need to get the names of the worksets that are within the link and visible in a view. So open view -> Visibility/Graphics Overrides -> Revit Links -> Custom -> Worksets -> and which are toggled?
I have almost 300 views with 20 different models linked, everyone of which have different worksets of which some are visible. I can easily get which revit links are visible
but how do I get which worksets of each link are visible…
Hey, the info coming out of the node isn’t telling you which links are visible… it’s telling you that the workset in the link is visible.
However, unfotunately, I was using the WorksetVisibility and that’s not giving the output I’d hoped… If you see below it is returning UseGlobalSetting…
Perhaps this is different to the tick box? Hmm… We’d need to find that Property in the API to extract it… But I can’t see it?
No need to. You did helped me because from what you did achieved we can conclude that there is indeed no property in API to recall the data of worksets of the link. So i knew that it’s can’t be changed but now I know that it can;t be recalled either.
Unless there is anything you can add or maybe other can, I think this topic can be closed.
You can always try asking @Jeremy_Tammik, maybe there is some miracle way off the beaten path that he may know of. Try asking on the Autodesk forums, there tends to be a greater community for specifically API-related stuff.
In my mind, asking Jeremy is a bit like ringing Buckingham Palace and expecting the Queen to answer
I made a post on the API forum here…
@kennyb6 thanky for the tip!
@Mark.Ackerley now you get another thanks from me! I’ll be very glad to hear when/if you get an answer.
I saw the answer of Jeremy Tammik
Nope, sorry, there is currently no API access to any of the link visibility settings.
If you need this, you might want to submit a request for it on the Revit Idea Station and post a link to it here to gather many votes for it.
Obviously, please check for any existing similar wishes first.
Thank you for trying @Mark.Ackerley!
hi bro @fluffyhugger ,
I just bumped onto this thread… And I see that this topic has been here for a few years now… but I just want to ask if this issue about the API for the visibility settings of linked documents in a view has been solved yet in today’s revit version?
Thanks and best Regards ^^