I tried to write a python script to import an stl mesh and then try to apply on it, within the mesh module, the option "Evaluate & Repair", and then export the repaired stl mesh overwriting the original file.
Is it possible to recall this option? I had no problem in importing the mesh module and the stl mesh but I do not know how to recall this option in the script, I did not find references in the documentation in order to do it.
Thank you in advance
Script to use the Evaluate & Repair option for an stl mesh
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 1
- Joined: Thu Nov 24, 2016 8:57 am
Re: Script to use the Evaluate & Repair option for an stl mesh
Try this:
Code: Select all
mesh = ...
mesh.harmonizeNormals() # fixes the orientation if needed
mesh.removeNonManifolds() # removes all triangles when an edge is shared by more than two triangles
mesh.fixIndices() # fixes errors in the actual data structure
mesh.fixDegenerations() # tries to fix degenerations by either splitting or removing triangles
mesh.removeDuplicatedFacets()
mesh.removeDuplicatedPoints()
mesh.fixSelfIntersections() # removes all triangles involved in a self-intersection
Re: Script to use the Evaluate & Repair option for an stl mesh
Thanks for those repair functions wmayer. Is there a python function that will evaluate the mesh to check and return if it is broken or not? Would it be possible to add if not? Thanks again.