Setting all material parameters to <By Category>

I am attempting to use a script to get rid of all of the previously set materials in a project and replace them to be set to When I do this I get an error message in my final step that says “Warning: Parameter.SetValue operation failed.
The call is ambiguous between the following methods or properties: ‘Revit.Elements.InternalUtilities.ElementUtils.SetParameterValue(Autodesk.Revit.DB.Parameter, Revit.Elements.Element)’ and ‘Revit.Elements.InternalUtilities.ElementUtils.SetParameterValue(Autodesk.Revit.DB.Parameter, string)’” If anyone has any advice on how to fix this please let me know!

1 Like

I have a similar question. How to set a material parameter “By Category”?

1 Like

I’m also trying to use Dynamo to set material parameters to .

It seems that trying to set a material to By Category doesn’t work because By Category is not technically a material; It’s the wrong data type. Even using Element.Get on another material that’s already set to By Category returns a string…

Would be cool if Dynamo or the API had a way to set a parameter to By Category even though it doesn’t fit the data type…

I am not sure, but try setting the value to -1 and not null. The Revit API doesn’t do nulls, it does ElementId.InvalidId or -1 when there is no value for that parameter type.

1 Like

You can set a material to By Category to use this node (in clockwork)
image