Workset Visibility in View Templates

Hi all,

I´d like to create a node where you can feed a list of Worksets and a list of View Templates.

This node will turn the visibility of the selected nodes to Hidden and the not selected to Visible just on the selected View Templates.

Unfortunately, I have no idea of Python :frowning:

Researching on the internet I came across this other node (from Drew Jarvis at Cansel) which turns off the visibility of some workset on the active view only. I´d like to modify it so I can feed a list the View Templates instead.

Thanks for your help!

See the code below:

    import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

Workset = IN [0]

doc = DocumentManager.Instance.CurrentDBDocument
view = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument.ActiveView

coll = FilteredWorksetCollector(doc).OfKind(WorksetKind.UserWorkset)

TransactionManager.Instance.EnsureInTransaction(doc)

for ws in coll:
	view.SetWorksetVisibility(ws.Id , WorksetVisibility.Hidden)
	
for ws in coll:
	if ws.Name.Contains(Workset):
		view.SetWorksetVisibility(ws.Id , WorksetVisibility.Visible)

TransactionManager.Instance.TransactionTaskDone()

I built a few nodes that can handle this:

Please download the latest Archi-lab.net package to see those.

As an explanation to what i posted in that image. View Template is basically a View so they behave very similarly. You can use the View nodes from archi-lab package to add things like View Filters and now also set visibility for worksets using those.

Cheers!

5 Likes

Awesome!

Thanks @Konrad_K_Sobon I totally missed that node from the Archi-Lab package.

Hi,

I’m new here and in the dynamo world, just started to look and this to be able to do some stuff automatically and i got some few things working well like creating some workset automatically with some revit links and changing in the same time the workset type and instance of that particular revit link. Pretty cool and saves lot of time !

By reading this post, i was wondering if it can be possible the manage the workset visibility of the links instead of the view templates ? This would be a dream for BIM Managers who had some project with over 120 links in each model. It becomes a nightmare to handle manually.

Thanks everyone !

Hi, @brunopierre.caron

Have you seen this?

Marcel

Might- hold on lemme add more emphasis- MIGHT be able to use the select elements in linked model node out of archilab, query their workset, and hide them en-mass in a list of views. Not workset controlled and I hate using ‘hide in view’ per element but it is a possible workaround until this functionality is opened up in the API.

@jacob.small

What i mean is something like this:
The richtclick command Apply Template Properties.
So:


Store in excel the name of the view, UniqueId of the view and the original viewtemplate name.
With the nodes for setting the template set to this:

Then revert back to the original viewtemplate.
The tickmark in the second picture should only be set to V/G Overrides Worksets (my bad)
Marcel

1 Like

Sweet! As always thanks for showing all those cool little tricks I never knew were there!

@jacob.small

Thanks.
We do this on a regular basis by setting all linked files to halftone accept the ones we want to emphasize in our sheets.
There are far more cases in which this workflow can be usefull.
There should be two workflows btw, one for setting the temporary template and one to revert back again.
We also store the original viewtemplate name in a shared parameter which is set to the catagory views, so you can check that everything is set properly.

Marcel

Does the node takes Multiple Views?

I’ve tried feeding 3 views and i got an error.

> Warning: One or more of the input types are not matching. Couldn’t find a version of SetWorksetVisibility that takes arguments of type (__array,__array,__array)

First up, check your lacing and list levels. If that doesn’t work, ensure that you are on the most current version of Archi-Lab for your Revit and Dynamo version. If that doesn’t work please start a new topic as this one is now 2 years old and has a solution already.