How to use reposition with smooth boundary in Python #5486
Answered by Grantim
ParvGuptaSpCT asked this question in Q&A
-
| Hello Devs! I'm trying to replicate reposition feature in MeshInspector after filling hole with smooth curvature, but unable to reproduce the same result in code. for reference I'm adding the steps below;
Can you help me with the which method and parameters will help me reproduce the same result. Thanks!! |
Beta Was this translation helpful? Give feedback.
Answered by Grantim Dec 11, 2025
Replies: 1 comment
-
| Hello! The script should look somehow like this: from meshlib import mrmeshpy as mm mesh = mm.loadMesh(__file__+"/../clean_mesh.stl") # fill hole fhnSettings = mm.FillHoleNicelySettings() fhnSettings.smoothCurvature = True fhnSettings.triangulateOnly = False fhnSettings.triangulateParams.metric = mm.getUniversalMetric(mesh) fhnSettings.maxEdgeLen = mesh.averageEdgeLength() fhnSettings.maxEdgeSplits = 1000000 # just large number not to stop too early fhnSettings.naturalSmooth = False newFaces = mm.fillHoleNicely(mesh,mesh.topology.findHoleRepresentiveEdges()[0],fhnSettings) # decimate dSettings = mm.DecimateSettings() dSettings.maxError = 0.001 * (mesh.computeBoundingBox().diagonal() / 3.0) dSettings.maxDeletedFaces = 1000000 # just large number not to stop too early dSettings.maxDeletedVertices = 1000000 # just large number not to stop too early dSettings.region = newFaces mm.decimateMesh(mesh,dSettings) # reposition incidentVerts = mm.getIncidentVerts(mesh.topology,newFaces) mm.positionVertsSmoothly(mesh,incidentVerts,mm.EdgeWeights.Cotan,mm.VertexMass.NeiArea) mm.saveMesh(mesh,__file__+"/../res.stl") |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by Fedr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment



Hello!
The script should look somehow like this:
(you can tune the parameters to slightly change the result)