Help with python scripting specifically footprint.Add3DModel(model)

Hello. I am just getting started with Python scripting in PCBnew, very cool.
I have successfully written a Python script that will find all my resistors and add a custom 3-d STEP model to the resistors via the method:

footprint.Add3DModel(model)

This works incredibly well, however if I run the script twice, (for debugging or whatever) I end up with multiple 3-d models added to one component. Not desirable. My question is that: Is three an equivalent method in PCBnew that will remove a 3d model from a footprint. For example, what I would like is something like:

footprint.RemoveAll3DModels()

I have not been able to find anything to remove a model in the API.

Thank you,

---Lou

I’m not aware of a ‘Remove…’ The way I do it (using python, or sometimes in a Text-Editor) is to simply Edit the Footprint and Delete the Model from it.

Usually, I use my home-grown Python App if I need to do it in a Bulk way (meaning, do it for more than just one footprint…).

Below shows example of the Step line in a Footprint.

Do this if you want to remove all models
footprint.Models().clear()

Check this for more things you can do with the class that Models() returns
https://docs.kicad.org/doxygen-python-8.0/classpcbnew_1_1VECTOR__FP__3DMODEL.html