You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
The text was updated successfully, but these errors were encountered:
First, split the mesh into the three individual bodies. They're not connected at all.
importpymeshfiximportpyvistaaspv# we're going to subdivide, for whatever reason this helps meshfixmesh=pv.read("bridge08.stl")
sub_div=mesh.subdivide(1)
bodies=pv.MultiBlock([body.extract_surface() forbodyinsub_div.split_bodies()])
bodies.plot(multi_colors=True)
Next, let's join the first and last body (the teeth I'm assuming?)
# join the bodies within pyvistajoined=bodies[0].boolean_union(bodies[2])
bodies[1] =bodies[1].compute_normals(flip_normals=True)
final=joined.compute_normals(auto_orient_normals=True).clean()
# cleantin=pymeshfix.PyTMesh()
tin.load_array(final.points, final.faces.reshape(-1, 4)[:, 1:])
tin.clean()
mfix=pymeshfix.MeshFix(*tin.return_arrays())
mfix.plot()
The hard part is now the dental bridge. I'm not able to get pyvista to merge it using any boolean_* filter, nor will pymeshfix accept it; it keeps removing it and using join_closest_components just isn't working. I'm a bit at a loss how to proceed. There might be a way to do this by manually dropping faces from the "bridge" (bodies[1]), as I think PyVista and meshfix really don't like how that surface is configured as it sorta wraps in on itself:
Hey,
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
The text was updated successfully, but these errors were encountered: