C4d python delete material


#1

Hello everyone,

I’m struggling to find an answer to my question.
I have created a script and it is working fine.
The problem is that I can’t find the python command for deleting materials in the scene(whether used or not used).
to delete an object one can write:
obj.Remove()
but for materials it is not working with the material

this is my material:
DelMtl = doc.SearchMaterial( “Mat.2” )

I want to delete it by name
What should I do?

I can’t delete it by hand because I’m writing a script that will automatically import objects and creat the materials and saves the file than deletes everything and goes to the other objects…

thank you for your help!!! :slight_smile:

best regards,
Karim