Workset Editability

yea because the list of structure for that code doesnt work with that. My final product is to open multiple documents and checkout worksets with a specific naming convention. If you just want to checkout workset in current opened document then the code below should work.

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
2 Likes

Do i need 2 IN?

nope dont need. just one. can check what is the error showing? because the code are all typed here manually. so i might have missed some indent

1 Like

Noted. here’s the error :

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 39, in
AttributeError: ‘str’ object has no attribute ‘Id’

ah, you are feeding the wrong input, feed the document.worksets output to the input of List.filterbyboolmask

and also set lacing of list.contain item to longest

see my post carefully

1 Like

oh, lacing?
I set it to longest now…still getting same error.

look carefully at my previous post, you are feeding wrong input to the List.FilterByBoolMask node

1 Like

My bad! i wire the filtering to the Workset.Kind
working properly now…

Thank you so much!

no worries man. glad to be able to help you

1 Like

@stillgotme

I want to achieve the opposite, that all User Create Worksets are converted to non-editable. How do I do this, I have no experience with Phyton scipting. Who has a solution for this?

Thanks in advance.

this post has exactly what you want

@stillgotme,

Hi, I find the code for Editable but not the code for Non-Editable.
How can I set my Workset to Non-Editable.

Thanks in advane.

i think you can just check out again using the same command???

I used this code in my script and edited to non editable and it doesn’t seem to work for me, can anyone help

NON EDITABLE api functions are read only, not sure if this has chganged but looking for work arounds

what’s then?

sorry for stupid question