Workset and worksharing set up: workset set to noneditable

Hey Everyone,

Newish to dynamo and python, found this script that sets worksets to non editable.

I’m trying to add it to a larger script that can set up new files for projects. Makes a new file a workshare file, creats worksets, set them all as non ediable and seting some as non visible, and each time you open the project file you need to set your workset.







Here’s the script thats giving me errors tick non edibatble

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

Hello and welcome…had you tried to check this here out…it could probably help you…

1 Like

Yeah thats’s where I got the code for editablity from.

problem is even if I set up the list filter by boolen input feed for the pythony node it still doesn’t work, the error gose away but yeah…

I was hopping someone might see the somthing wrong in the deffinitions or know another way to do it with a diffrent api

I’ve seen

wsOptions.OpenWorksetsDefault = SimpleWorksetConfiguration.AllEditable;

I’m not sure how to put it all together tho

maybe somthing between

IsEdiable and WorksetConfiguration Members

no errors but still yes :frowning:

thanks for responding btw

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