How to use the pymeshfix._meshfix.PyTMesh 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 pyvista / pymeshfix / tests / test_pyx_meshfix.py View on Github external
def test_select_intersecting_triangles():
    meshfix = _meshfix.PyTMesh(quiet=0)
    meshfix.load_file(examples.bunny_scan)
    faces = meshfix.select_intersecting_triangles()
    assert faces.any()
github pyvista / pymeshfix / tests / test_pyx_meshfix.py View on Github external
def test_remove_components():
    meshfix = _meshfix.PyTMesh()
    meshfix.load_file(examples.bunny_scan)
    assert meshfix.remove_smallest_components()
github pyvista / pymeshfix / tests / test_pyx_meshfix.py View on Github external
def test_load_array():
    meshfix = _meshfix.PyTMesh()
    v = bunny.points
    with pytest.raises(Exception):
        meshfix.load_array(v, bunny.faces)

    f = bunny.faces.reshape(-1, 4)[:, 1:]
    meshfix.load_array(v, f)
    v, f = meshfix.return_arrays()
    assert f.shape[0] == bunny.n_faces

    with pytest.raises(Exception):
        meshfix.load_array(v, f)
github pyvista / pymeshfix / tests / test_pyx_meshfix.py View on Github external
def test_fill_small_boundaries():
    meshfix = _meshfix.PyTMesh()
    meshfix.load_file(examples.bunny_scan)
    ninit_boundaries = meshfix.boundaries()

    meshfix.fill_small_boundaries(refine=False)
    assert meshfix.boundaries() < ninit_boundaries
github marcomusy / vtkplotter / examples / other / meshfix.py View on Github external
from vtkplotter import Plotter, boundaries
try:
	# 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 6 months ago

Package Health Score

65 / 100
Full package analysis

Similar packages