How to select empty Worksets and delete them?

I want to ask if anyone have a dynamo script that can delete the empty worksets from the model

Not sure how to delete worksets, but here is a quick way of finding which ones are empty:

1 Like

Hi there,

I did the same for selecting empty worksets. Then I tried to delete those ones, but I could’t do it.

Dont know if the thing is that we can’t delete worksets or maybe I didn’t use the properly node.

Cheers

It seems Worksets are not Revit elements. I have not looked in to this, but I believe that is the reason why the element deletion nodes does not work.

Work sets are elements, but their class doesn’t have a delete method in the api to keep people from deleting stuff they actually need but think they don’t. This would be a GREAT way to corrupt a model otherwise.

Send the list to an excel excel and open the work set manager. That interface has built in protections to keep you from getting too aggressive. :smiley:

2 Likes

Seems reasonable :slight_smile:

Hi guys sorry for not answering but I was in vacation and thank you all for your support.
There is an easy node for getting the empty workset from Bakery

but the problem is how to delete it

1 Like

@jacob.small Worksets are not Revit Elements in the sense that they are not Element class objects. That means they don’t have any of the properties of the Element class objects and cannot be deleted with the same methods.

I always refer to Inheritance structure in the Revit API to determine what is what. Workset’s inheritance tree doesn’t have Element in it so it’s not an Element in my book.

image

Unlike something like a Wall which inherits from Element so it’s an Element:

image

@andre.abotnes With that being said, there is actually no method in the API that allows you to delete a Workset. *as far as I am aware Dynamo won’t help here.

4 Likes

Do you know why this message appear ??

This question has now been answered. The answer is no you cannot delete a workset using Dynamo. That exception though is something you should report here: https://github.com/DynamoDS/Dynamo/issues

1 Like