Replies: 1 comment 2 replies
-
|
Hello!
Repair tab on MeshHealer is much more complex and utilizes several algorithms iteratively with lots of settings, here are some examples: from meshlib import mrmeshpy as mm
def remove_small_components(mesh : mm.Mesh, minAreaRatio : float ):
mesh.deleteFaces(mesh.topology.getValidFaces() - mm.MeshComponents.getLargeByAreaComponents(mesh,minAreaRatio*mesh.area(),None))
def close_small_holes(mesh : mm.Mesh, maxParimeter : float):
mesh.deleteFaces(mm.findHoleComplicatingFaces(mesh))
holeIds = mesh.topology.findHoleRepresentiveEdges()
smallHoleIds = []
for i in range(len(holeIds)):
if mesh.holePerimiter(holeIds[i]) < maxParimeter:
smallHoleIds.append(holeIds[i])
fillSettings = mm.FillHoleNicelySettings()
fillSettings.triangulateParams.metric = mm.getMinAreaMetric(mesh)
fillSettings.triangulateParams.multipleEdgesResolveMode = mm.FillHoleParams.MultipleEdgesResolveMode.Strong
fillSettings.maxEdgeLen = mesh.averageEdgeLength()
fillSettings.triangulateOnly = False
fillSettings.smoothCurvature = False
fillSettings.maxEdgeSplits = 20000
for smallHoleId in smallHoleIds:
mm.fillHoleNicely(mesh,smallHoleId,fillSettings)
def fix_self_intersections(mesh:mm.Mesh):
params = mm.SelfIntersections.Settings()
params.maxExpand = 2
params.relaxIterations = 2
params.method = mm.SelfIntersections.Settings.Method.CutAndFill
params.touchIsIntersection = False # required to disable subdivision on fixing self-intersections
print(params.subdivideEdgeLen)
mm.SelfIntersections.fix(mesh,params)
def fix_degeneracies( mesh : mm.Mesh, tolerance : float, force : bool ):
mm.fixMultipleEdges(mesh)
params = mm.FixMeshDegeneraciesParams()
params.maxDeviation = 0.1*tolerance
params.tinyEdgeLength = 0.01*tolerance
params.criticalTriAspectRatio = 1e3
params.mode = mm.FixMeshDegeneraciesParams.Mode.Remesh
if force:
params.mode = mm.FixMeshDegeneraciesParams.Mode.RemeshPatch
mm.fixMeshDegeneracies(mesh,params)Usually, we recommend users to adjust script for their specific data. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I’m trying to reproduce the same mesh healing results obtained with the MeshHealer tool in the MeshInspector web app using the python_scripts/healer.py script.
However, the output from the Python script appears noticeably different particularly in hole filling and mesh reconstruction quality.
In the MeshInspector app, I can control several repair options such as:
Disconnected Parts (large/small), Holes (large/small), Self-Intersections ..
I would like to know:
How can I access or adjust these same parameters when using python_scripts/healer.py ?
Does the MeshInspector web app use a newer or more advanced version of the healer function compared to the Python script?
Beta Was this translation helpful? Give feedback.
All reactions