Free resource: geometry cleaner script

Here’s a nifty little Python script to help clean up models imported from FBX/STL/OBJ/whatever. It’s a simplified version of a custom add-on we use at my studio. Over the years I’ve found myself performing the same operations when prepping stock assets or CAD files for animation, so I wrote an add-on to do it for me.

This script automates the following tasks:

  • Removes custom normals data
  • Clears any parenting and applies transforms
  • Sets autosmooth
  • Recalculates normals
  • Converts tris to quads
  • Removes doubles

Enjoy! Feel free to contribute patches or open issues if you find any.


Thanks for sharing this useful script. Great contribution!

I had been looking a simple way to add scrips as easily accessible buttons in UI without need to run in script editor or create as addons. Blender is unfortunately missing highly important toolshelf to just drag&drop this type of scripts for later use. I recently found the below addon that is closest to what I’d like to have, so maybe it’s useful for others as well. Not mine, so credits to the creator.

RivinHD/ScriptToButton (

No problem, @Saku! The only reason it’s not a proper add-on like the one I use at work is because a buddy of mine needed help cleaning messy FBX files for a game project and he’s a complete Blender noobie. He comes from a computer science/coding background, so I wanted to keep it as simple for him as possible to use at first.

It’s pretty trivial to take the script and turn it back into an add-on again. If there’s enough interest I might do it myself, but anyone else is welcome to as well.

EDIT: Just wanted to also mention that I agree with you, I do miss Maya’s toolshelf from time to time. It’s a really understated feature.

I don’t think this type of assisting scripts need to be addons at all, so it’s good like this. Also easier to store, modify and share as no need to install or update the addon.

Yeah, in Maya the toolshelf works well, but I think it’s somehow not understood in Blender community or by developers properly. :slight_smile: This is clear if have used it, but I just had to mention it, as in a production environment it’s just easiest way to share stuff with other team members. And for personal use as useful when can just grab needed command/commands from info window and paste to toolshelf even without any scripting experience.

1 Like

@ Wayland
Thank you to sharing your script for free.

I imported LWO file (CAD) on Blender 2.91, and I have a lot of Ngons and Tris mesh.

I try to use your script to clean up, but it’s not converted tris to quads

When I import LWO file on Blender 2.49b I not have any ngo and tris mesh.

RDC_Clean up.lwo (25.0 KB)

Hey @serviteur, I’m happy to take a look. Should be able to get back to you on this thread later tonight.

Alright, I downloaded your test file and took a look. I don’t think there’s necessarily a bug in the script - I think it’s more related to the defaults for the “tris to quads” function and this particular model.

I tried converting tris to quads on the model explicitly in the Blender UI and very few edges actually changed. And the mesh is identical, whether it’s run through the UI or the Python script, so it seems to be running the function as-expected. When the function can’t calculate a quad from a collection of tris, it just leaves it as-is and I think that’s what’s happening here. If you run the tris to quads function in Blender’s UI you can adjust the angle it uses to calculate the conversion and see if it has any effect.

If I were optimizing this model, I would run the script to cover the basics, then go in by hand and fix the geometry where it really matters (sometimes it doesn’t, and leaving it as it is would be more than enough).

Sorry, mate. Wish I had a better answer for you. :slight_smile:

Thanks wayland for your answers.