How to use the pymeshfix._meshfix.Repair function in pymeshfix

To help you get started, we’ve selected a few pymeshfix examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marcomusy / vtkplotter / examples / other / meshfix.py View on Github external
# Credits:
	# https://github.com/MarcoAttene/MeshFix-V2.1
	# https://github.com/akaszynski/pymeshfix
	from pymeshfix._meshfix import PyTMesh, Repair
	from pymeshfix.examples import bunny_scan
except:
	print('Install pymeshfix with: pip install pymeshfix')
	exit()

########################################### PyTMesh repair
inputmesh = bunny_scan # 'pymeshfix/examples/StanfordBunny.ply'
ouputmesh = 'meshfix_repaired.ply' # try e.g. vtkconvert -to vtk repaired.ply

tm = PyTMesh()
tm.LoadFile(inputmesh)
Repair(tm, verbose=True, joincomp=True, removeSmallestComponents=True)
tm.SaveFile(ouputmesh)

########################################### vtkplotter
vp = Plotter(shape=(2,1))

act_original = vp.load(inputmesh)
bo = boundaries(act_original)

act_repaired = vp.load(ouputmesh)
br = boundaries(act_repaired)

vp.show([act_original, bo], at=0)
vp.show([act_repaired, br], at=1, interactive=1)

pymeshfix

Repair triangular meshes using MeshFix

GPL-3.0
Latest version published 5 months ago

Package Health Score

69 / 100
Full package analysis

Similar packages