I try to repair the following mesh (a dental bridge):
Within the mesh are some holes and also intersecting triangles. I use the function tin.small_boundaries() and if i detect intersecting triangles also tin.clean(max_iters=10, inner_loops=3). Unfortunately, the dental bridge is split, leaving only one tooth in the end:
Do you maybe have some ideas how i can fix this issue? You can find the used source code and the *.stl file below: ScriptAndModel.zip
# -*- coding: utf-8 -*-
import pymeshfix
def plotMesh(tin):
# return vertices and faces
vertices, faces = tin.return_arrays()
# Create object from vertex and face arrays
meshfix = pymeshfix.MeshFix(vertices, faces)
# Plot input
meshfix.plot()
# Create TMesh object
tin = pymeshfix.PyTMesh()
# load stl file
tin.load_file("bridge08.stl")
# visualize input Mesh
plotMesh(tin)
###############################################################################
# CLEANING ROUTINE
# Attempt to join nearby components
# tin.join_closest_components()
# Fill holes
tin.fill_small_boundaries()
print('There are {:d} boundaries'.format(tin.boundaries()))
# check for intersecting triangles
faces = [tin.select_intersecting_triangles()]
# if intersecting triangles are detected within the mesh
if faces:
# Clean (removes self intersections)
tin.clean(max_iters=10, inner_loops=3)
###############################################################################
# visualize output Mesh
plotMesh(tin)