Removing Only Certain elements within a category

Hi All,

First timer here so i hope i explain what i require help with here.

We get sent from the architects house files that show everything from Walls roofs and radiators to fire alarms.
I’ve got a graph set up to remove all views, sheets & schedules which works fine. And a graph to remove all model elements which also works as it should. However i would like to keep some walls that are below ground and on a separate work-set labelled “substructure”. (The rest of the walls are on work-set “core”) So i’m struggled to filter out the substructure walls from being removed. I’ve attached an Image of what i currently get using my script (With missing walls) And the other is what i’d like to achieve (showing internal walls & End wall)
Also there is a screen shot of the basic layout of the graph. (As a new user it wont let me upload files)
Any advice would be greatly appreciated.

Kind Regards,
Lee

Hi @Drizzle if all of your elements, that should not be deleted, are in the same Workset, you can retrieve the workset name of the elements and use a FilterByBoolMask, to isolate the walls that should be deleted. I modified a python script from Clockwork and made a small graph that should do the trick:
FORUM_DeleteElementsNotInWS.dyn (13.8 KB)

Hope it helps!

Screenshot:

Python Code:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument
faminsts = UnwrapElement(IN[0])
output = list()
for item in faminsts:
	try:
		ws = doc.GetWorksetTable().GetWorkset(item.WorksetId)
		output.append(ws.Name)
	except:
		output.append(None)
OUT = output
1 Like