My Python script works in IronPython2.7 and if you send in a flat list of worksets. I have tested it. If you are using it this way it is likely something specific to your project, for example you cannot check out a workset as another user already is using it.
I understand there may be problem with version and i was looking for controlling Ediatble & Non-Editable tabs in workset for the purpose of assigning my name in âProject Infoâ in Project Standards. so, no one cannot move the project coordinates without my permission.
if you have any nodes related to it let me know as well i am following your âcrumpleâ so if you add in âCrumpleâ package it will be helpful for everyone.
thank you
In that case they are different types of worksets and I am unsure if they are accessible in the same way.
I tested them using the WorksetKind âUserWorksetâ:
My node in Crumple called âCollect.Worksetsâ retrieves those worksets by the kind.
Checkout of other types of worksets might be locked off or not safe to check out this way as they are typically managed behind the scenes by Revit to my understanding.
If you break the code out of the try/except and just run it in the main script body it might reveal why it doesnt work in an error message.
This is a GREAT way to corrupt a model and take a team offline or force a recovery to a prior version. Train your users and monitor the location and youâll come out ahead.
Thanks for your input! Iâm diving deep into learning Dynamo for Revit. While working on a script for worksets, I found many others are looking for answers too. Python scripts havenât worked out for me, so Iâm hopeful that someone creates a dedicated node for PROJECT STANDARDS IN WORKSET. It could really quench the thirst for knowledge in this area!
That is an incredibly specific node, it likely wont happen. Better that you learn how to access a workset of that kind. A filteredworksetcollector using the ofkind method can do the trick.
Seconding Jacobâs recommendation to test it carefullyâŚ
Testing usually wonât show anything wrong. Itâs sort of like how when you test it looks like you can use OneDrive to hose your central files and allow remote collaboration, until you try it in production and suddenly you start seeing corruption warnings.
using onedrive will definitely hose a central file!
Yep.
I had to explain why âthe test you ram by saving one file and using it yourself for two syncs wasnât a valid testâ about once every 2 minutes when the pandemic hit and everyone shifted to work from home.
I will encourage this completely taboo behaviour.
This script can.
- Sync your model
- Find all worksets containing a criteria as a name âIn your case Project Infoâ i guess?
- Checkout those worksets.
You can go full ham and corrupt the heck out of anything with this badboy by always using it to sync your model instead of the regular sync options, you will remain the owner of the specified worksets⌠you greedy boi.
I take no responsibilty for any adverse impacts of this.
In your recreation, remove the code block after the worksetbyname node and tap it straight into the checkout node.
Sync with Central
# Made by > Max Fasher
# Dynamo Forum > https://forum.dynamobim.com/u/pyxam
# Linkedin > https://www.linkedin.com/in/max-fasher/
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
relStandardWS = True
relViewWS = True
relFamWS = True
relUserWS = True
relCheckedOutElems = True
compact = False
saveLocalBefore = True
saveLocalAfter = True
comment = ""
runme = True
if runme:
doc = DocumentManager.Instance.CurrentDBDocument
tOptions = TransactWithCentralOptions()
rOptions = RelinquishOptions(False)
rOptions.StandardWorksets = relStandardWS
rOptions.ViewWorksets = relViewWS
rOptions.FamilyWorksets = relFamWS
rOptions.UserWorksets = relUserWS
rOptions.CheckedOutElements = relCheckedOutElems
sOptions = SynchronizeWithCentralOptions()
sOptions.SetRelinquishOptions(rOptions)
sOptions.Compact = compact
sOptions.SaveLocalBefore = saveLocalBefore
sOptions.SaveLocalAfter = saveLocalAfter
sOptions.Comment = comment
TransactionManager.Instance.ForceCloseTransaction()
try:
doc.SynchronizeWithCentral(tOptions, sOptions)
OUT = True
except:
OUT = False
else: OUT = False
Workset Filter By Name
# Made by > Max Fasher
# Dynamo Forum > https://forum.dynamobim.com/u/pyxam
# Linkedin > https://www.linkedin.com/in/max-fasher/
#====================================================================#
#Imports
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
#====================================================================#
#Inputs
SearchSTR = str(IN[0]) #Criteria for which to search for Template
#====================================================================#
#Variables
inputdoc = DocumentManager.Instance.CurrentDBDocument
doc = DocumentManager.Instance.CurrentDBDocument
collector = FilteredWorksetCollector(doc) #Workset Collector
names = [] #List of Workset Names
#====================================================================#
#Filtering
names = [ws.Name for ws in collector.ToWorksets()]
#Use me if you want to contain this within the Python Script (Instead of an Input option)
##filtered_worksets = [ws for name, ws in zip(names, collector) if "View ##Template" in name]
#OUT = names, collector.ToWorksets()
filtered_worksets = [ws for name, ws in zip(names, collector) if SearchSTR in name]
OUT = filtered_worksets
Workset Checkout
# Made by > Max Fasher
# Dynamo Forum > https://forum.dynamobim.com/u/pyxam
# Linkedin > https://www.linkedin.com/in/max-fasher/
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import Element wrapper extension methods
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
# Import system library
clr.AddReference('System.Core')
from System.Collections.Generic import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
def ToList(x):
if isinstance(x,list):
return UnwrapElement(x)
else:
return [UnwrapElement(x)]
worksets = ToList(IN[0])
iDs = [ws.Id for ws in worksets]
Ids = List[WorksetId](iDs)
try: checkedout_ws = WorksharingUtils.CheckoutWorksets(doc,Ids)
except Exception,e: checkedout_ws = str(e)
OUT = checkedout_ws
I guess it wonât work. as you mentioned code as VIEW TEMPLATE in that definitely you will get workset but its USER WORKSET not a PROJECT STANDARDS WORKSET. i am here talking about PROJECT STANDARD WORKSET.


for this we need try out of VIEW TEMPLATE. (I am asking these doubts for learning process; while learning dynamo, this concept made me curious, so I am digging )
but thank you guys each and every one for responding.
You need to read my message more carefully, where i have view template you can change to project info.
I tried PROJECT INFO but I faced some errors. so, I thought it only works for user workset. I apology for that. let me show you the errors.
That is all.
it is working with one parameter.
what if we have multiple parameters?
Regards,