How to remove materials from Occurence Components?

Hi,

Do you know by a script how to remove all the materials from Occurence Components (and keep materials on Occurence Properties).

Thanks for your help.

1 Like

Hey there!

EDIT: Do you want to transfer the component materials to the Occurrence properties or just delete them because you already have some on your Occurrence properties? If the later, you can jump to the following answer.


You can use the scene.transferCADMaterialsOnPartOccurrences function.

Beware that Occurrence material property can only handle one material so if your model has a Part component with multiple materials assigned it won’t do anything for this Part, unless you split the geometry by materials first (using algo.explodeByMaterials)

Hi,
If you are trying to unset every subpart materials, it can be achieved by using something like that :

mats = pxz.scene.listSubpartMaterials(36)

idx = 0
for mat in mats:
	pxz.scene.setSubpartMaterial(36, idx, 0)
	idx = idx + 1