#401230
I'm trying to remove the material from the scene, the code just doesn't work whatever use "free()" or "extract()", anyone can give me some tip?

scene = Cmaxwell(mwcallback_cb)
scene.readMXS(mxsFile)
material= CmaxwellMaterialIterator()
mat = material.first(scene)
while not mat.isNull():
mat.free()
mat = material.next()
scene.writeMXS(mxsFile)
User avatar
By Brany
#401235
I'm afraid you cannot delete a material from the scene and keep using the material interator. Try to store the materials you want to delete in a list, and then delete each one:
Code: Select all
scene = Cmaxwell(mwcallback_cb)
scene.readMXS(mxsFile)
material= CmaxwellMaterialIterator()
mat = material.first(scene)
matlist = []
while not mat.isNull():
    matlist.append(mat)
    mat = material.next()
for m in matlist:
    mat.free()
scene.writeMXS(mxsFile)

Here's a screen recording of the issue: https://[…]

Ok good news that it runs, perhaps I need an upgra[…]

Actually, on further thought, there should be no r[…]

Cannot import .mxm files to materials panel in Rhino 7

bump. same here. tried the rhino 7 plugin again […]