Hi all,
I’m trying to use the Genuis Loci node to reload Revit Link Instances based on a list of closed worksets. But the output is null when I run the code. I have attached all files, including the Dyn file and the Python script I used to get the visibility settings of worksets in a specific view ( Export to Navisworks View in the linked model). The Python script works fine, and the output is what I need. But the final node does not respond. Can anyone help me with this, please? Thank you!
FrancWorksets.dyn (34.9 KB)
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitServices')
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
# Get the current document (host project)
doc = DocumentManager.Instance.CurrentDBDocument
# Inputs from Dynamo
linked_instance = UnwrapElement(IN[0]) # Input 1: Revit Link Instance
target_view_name = IN[1] # Input 2: View name in linked model
# Ensure we have a valid linked instance
if not isinstance(linked_instance, RevitLinkInstance):
OUT = "Error: Invalid Revit Link Instance."
else:
# Get the linked document
linked_doc = linked_instance.GetLinkDocument()
if linked_doc is None:
OUT = "Error: Linked document is not loaded."
else:
# Get the view inside the linked model based on the provided name
view_collector = FilteredElementCollector(linked_doc).OfClass(View)
target_view = None
for v in view_collector:
if v.Name == target_view_name:
target_view = v
break
if target_view is None:
OUT = "Error: View '{}' not found in linked model.".format(target_view_name)
else:
# Get all worksets in the linked document
workset_collector = FilteredWorksetCollector(linked_doc).OfKind(WorksetKind.UserWorkset)
# Separate lists for workset names and visibility settings
workset_names = []
visibility_settings = []
for workset in workset_collector:
workset_id = workset.Id
visibility = target_view.GetWorksetVisibility(workset_id)
# Convert visibility enum to readable text
visibility_status = {
WorksetVisibility.Visible: "Visible",
WorksetVisibility.Hidden: "Hidden",
WorksetVisibility.UseGlobalSetting: "Use Global Setting"
}.get(visibility, "Unknown")
# Replace "Use Global Setting" with actual visibility
if visibility == WorksetVisibility.UseGlobalSetting:
default_visible = workset.IsVisibleByDefault
visibility_status = "Visible" if default_visible else "Hidden"
# Append values to separate lists
workset_names.append(workset.Name)
visibility_settings.append(visibility_status)
# Output as two separate lists
OUT = workset_names, visibility_settings
@jacob.small I would appreciate if you could assist.
Guessing it is a version issue (meaning you need to update Genius Loci) or that you are missing a dependency (i.e. IronPython2).
If not you might have to provide a dataset to test with - not a real project but something which replicates your conditions so we know the Revit versions, structure and configuration you are working with.
1 Like
Thank you Jacob. I checked that but did not work. I think I might realize why it’s not working. All our models are ACC cloud models and linked from there not our locals. I tested this Dynamo script with local models and it worked with local links. I guess that Genius Loci node is not compatible with cloud shared models and cloud linking - Likely an opportunity for improvement. Your thoughts?
Do you think this can be done in Dynamo if my guess is right? Do we have methods to connect to ACC using Revit API?
Sorry Jacob, the files and data are our project and I’m unable to share the data. But as you said I can replicate something.
@GavinCrump , I would like to loop Gavin in as well. He might be interested.
Appreciate your help both legends 
Yes, it can be done but the level of effort goes up a fair bit.
Why you are automating this also comes into play, as if it is for a single project the workflow likely could alter to remove the automation need/scope; while if it is for many projects Dynamo might not be the right tool.
1 Like
I’m 99% sure you cant reload links the standard way using the typical API calls.
Sparrow has a ndoe for this but it needs link and model guids in order to work.
We have APS based approaches at work for Acc generally, so I havent tried making this work before.
1 Like
It’s a long story, Jacob - Resistance against BIM standards. Here in Canada, people working with models during the construction stage traditionally use Revit linking without considering visibility settings. Each subcontractor has their own standard or method for worksets management, often modifying or creating their workset names - lack of integrated standards in other words. As a result, we have NWC export views in many Revit files from different subcontractors, each with its own workset visibility setting. That’s why I was wondering if Icould share a script with all subcontractor modelers, so when they link the models, only visible worksets are loaded. Also, we generate sleeve drawings for design engineers to review and we need to make sure garbage MEP penetration/embeds are not loaded into the model.
Thanks Gavin for the insight. I tried that and get the GUIDS using Python. That node works with BIM360 not ACC I guess.
The great thing with Canadian subs for BIM work is they’re 100% willing to take direction when it’s been contracted. If it hasn’t, you get the mess you’re in now. If it has you simply state “hey you aren’t following the BIM Execution plan so we aren’t paying you this week” and suddenly the automation becomes a non-issue. I have watched some very big firms do some amazing work (think cloud worksharing across trades and even crossing international boarders back when BIM360 still had the word “Teams” in it if you were worksharing). This doesn’t have to be a problem and you’re best bet is to clean up the processes before bringing the subs on.
But if you can’t make that happen, then your best bet is to move into APS for this.
As is your effort as this won’t scale beyond one project in Dynamo as you don’t have the requisite project and model GUIDs (as @GavinCrump indicated, these are a necessary bit of information). So you’d either have to build your own Dynamo package that leverages APS to get the info (at which point why use Dynamo?), or spend more time looking that information (every upload from every sub is a new potential GUID after all) and then building a spreadsheet of some sort to pull the data from - not scalable in my opinion.
Fortunately the APS effort isn’t that bad - I think a few of the “intro to” and “primer” courses actually cover getting the info you need, so there might be a ‘combination’ of APS and Dynamo to mine the data and update the models as an intermediate step. You might even be able to access some of it with ACC Connect (a low code entry point to APS) if you can get that set up on your account.
2 Likes