Worksets visibility of a link in a given view

Hi,

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:

image

Hey,

I’d really like to think so, unfortunately I’m not sure it’s possible with a Link :frowning:

So to get a Workset’s visibility from a view, the method I’m aware of is…
http://www.revitapidocs.com/2018/1c37557b-9bd4-12e2-dffb-c3a25cf9a375.htm
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…
image

So, unless there is a get linked Workset visibility property/method somewhere, I don’t think it works…

Apologies,

Mark

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

The numbering seems to include all the linked worksets too!

image

Still might be a bit flaky, and needs some work, but it does get a result…

Cheers,

Mark

1 Like

I’m noob what goes about python. Can you please share the code?

I butchered a bit of clockwork code in a shameful way…

image

#thanks to Clockwork!

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

inputdoc = UnwrapElement(IN[1])
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[2])

for l in list:
    listId = l.Id
    try: 
        wks = []
        inputView.GetWorksetVisibility(listId)
        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
            else:
                visOut = 'Hidden' # False
            output.append([name, visOut]) 

    except:
        'Fail'
    
OUT = output

Thank you, but it gives me an error:

image

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

I’ve also done a bit of filtering and outputted whether visible…

Hope that helps,

Mark

Thank you very much for the effort but unfortunately it doesn’t work… :frowning:
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? :frowning:

http://www.revitapidocs.com/2018/437250cb-c87d-4492-9a53-bde8605012f4.htm

Apologies,

Mark

1 Like

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.

1 Like

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.

2 Likes

Thanks Kenny,

In my mind, asking Jeremy is a bit like ringing Buckingham Palace and expecting the Queen to answer :smiley:

I made a post on the API forum here…

https://forums.autodesk.com/t5/revit-api-forum/linked-file-workset-visibility-in-view/td-p/8766425

Cheers,

Mark

1 Like

@kennyb6 thanky for the tip!
@Mark.Ackerley now you get another thanks from me! :grin: I’ll be very glad to hear when/if you get an answer.

1 Like

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!

2 Likes

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 ^^