Set Material of Category to Null

I try to set the material of a Revit Category to Null / Empty. Used the “Set SubCategory Properties” from GeniusLoci, what works well for assigning materials. But how to “deassign”? Inside Revit I can use the Button in the lower left. But how to do this with Dynamo???


Have u tried with blank? ("")

Yes, I did. But that doesn’t work. Seems to a problem with the type.

Have you tried feeding it a null?

Yes - but didn’t work.

Hello @norbert_graeser …how about this ?

PS…the way i have done it in the image above, has this issue it delete the material from the library…

I havent find out yet, how to just empty the subcategori material, set to no material

Maybe this has some clue

1 Like

Ah! It’s an element ID. The old -1 trick if I am not mistaken. Not sure how to produce that without Dynamo so editing the Python Konrad posted in that topic is the likely best path forward.


set Material to null (None) works perfectly (no need parameter)

import clr
import sys
import System
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

toList = lambda x : x if hasattr(x, '__iter__') else [x]
#Preparing input from dynamo to revit
cats = toList(UnwrapElement(IN[0]))

#Do some action in a Transaction

for cat in cats:
	cat.Material = None


OUT = cats

from Revit API doc


You can also use

Mat = ElementId.InvalidElemtId


Thank you for your help!

"cat.Material = None" is what do the job in a perfect way.