import os
from meshlib import mrmeshpy as mm
from meshlib import mrviewerpy as mv
mesh = mm.loadMesh("mesh.stl")
params = mm.OffsetParameters()
params.voxelSize = mesh.computeBoundingBox().diagonal() * 5e-3
if mm.findRightBoundary(mesh.topology).empty():
params.signDetectionMode = mm.SignDetectionMode.HoleWindingRule
offset = mesh.computeBoundingBox().diagonal() * 0.05
result_mesh = mm.offsetMesh(mesh, offset, params)
mv.launch()
mv.addMeshToScene(mesh, "Mesh 1")
mv.Viewer().preciseFitDataViewport()
mv.selectByName("Mesh 1")
mv.Viewer().preciseFitDataViewport()
mv.Viewer().showSceneTree(True)
os.system("pause")
mv.clearScene()
mv.addMeshToScene(result_mesh, "Mesh Offset")
mv.selectByName("Mesh Offset")
mv.Viewer().showSceneTree(False)
os.system("pause")
mv.Viewer().shutdown()
os.system("pause")