How to use pymeshfix - 10 common examples

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
import pytest
import pyvista as pv

from pymeshfix import _meshfix
from pymeshfix import examples

bunny = pv.PolyData(examples.bunny_scan)


def test_load_and_save_file(tmpdir):
    meshfix = _meshfix.PyTMesh()
    meshfix.load_file(examples.bunny_scan)

    with pytest.raises(Exception):
        meshfix.load_file(examples.bunny_scan)

    v, f = meshfix.return_arrays()
    assert f.shape[0] == bunny.n_faces

    # test saving
    filename = str(tmpdir.mkdir("tmpdir").join('tmp.ply'))
    meshfix.save_file(filename)
    new_bunny = pv.PolyData(filename)
github pyvista / pymeshfix / tests / test_withvtk.py View on Github external
def test_repair_vtk():
    meshin = pv.PolyData(bunny_scan)
    meshfix = pymeshfix.MeshFix(meshin)
    meshfix.repair()

    # check arrays and output mesh
    assert np.any(meshfix.v)
    assert np.any(meshfix.f)
    meshout = meshfix.mesh
    assert meshfix.mesh.n_points

    # test for any holes
    pdata = meshout.extract_edges(non_manifold_edges=False, feature_edges=False,
                                  manifold_edges=False)
    assert pdata.n_points == 0
github pyvista / pymeshfix / tests / test_pyx_meshfix.py View on Github external
def clean_from_file(tmpdir):
    outfile = str(tmpdir.mkdir("tmpdir").join('tmp.ply'))
    clean_from_file(examples.bunny_scan, outfile, verbose=False,
                    joincomp=False)
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 pyvista / pymeshfix / tests / test_withvtk.py View on Github external
def test_repair_vtk():
    meshin = pv.PolyData(bunny_scan)
    meshfix = pymeshfix.MeshFix(meshin)
    meshfix.repair()

    # check arrays and output mesh
    assert np.any(meshfix.v)
    assert np.any(meshfix.f)
    meshout = meshfix.mesh
    assert meshfix.mesh.n_points

    # test for any holes
    pdata = meshout.extract_edges(non_manifold_edges=False, feature_edges=False,
                                  manifold_edges=False)
    assert pdata.n_points == 0
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_clean():
    meshfix = _meshfix.PyTMesh()
    meshfix.load_file(examples.bunny_scan)
    # v, f = meshfix.return_arrays()
    # assert f.shape[0] == bunny.n_faces

    assert meshfix.boundaries()

    meshfix.clean()
    assert not meshfix.boundaries()
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

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