MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / load_mesh

Function load_mesh

python/pymesh/meshio.py:9–34  ·  view source on GitHub ↗

Load mesh from a file. Args: filename: Input filename. File format is auto detected based on extension. drop_zero_dim (bool): If true, convert flat 3D mesh into 2D mesh. Returns: A :py:class:`Mesh` object representing the loaded mesh.

(filename, extension_hint=None, drop_zero_dim=False)

Source from the content-addressed store, hash-verified

7from .save_svg import save_svg
8
9def load_mesh(filename, extension_hint=None, drop_zero_dim=False):
10 """ Load mesh from a file.
11
12 Args:
13 filename: Input filename. File format is auto detected based on
14 extension.
15 drop_zero_dim (bool): If true, convert flat 3D mesh into 2D mesh.
16
17 Returns:
18 A :py:class:`Mesh` object representing the loaded mesh.
19 """
20
21 ext = os.path.splitext(filename)[1] if extension_hint is None else extension_hint
22
23 if ext == ".geogram":
24 return Mesh(PyMesh.load_geogram_mesh(filename))
25 if not os.path.exists(filename):
26 raise IOError("File not found: {}".format(filename))
27 factory = PyMesh.MeshFactory()
28 if extension_hint is None:
29 factory.load_file(filename)
30 else:
31 factory.load_file_with_hint(filename, extension_hint)
32 if drop_zero_dim:
33 factory.drop_zero_dim()
34 return Mesh(factory.create())
35
36def deduce_face_type(faces, voxels):
37 if faces is None or faces.ndim == 1 or len(faces) == 0:

Callers 15

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
init_GeogramFunction · 0.85
quick_csgFunction · 0.85
load_meshMethod · 0.85
tetrahedralizeFunction · 0.85
TEST_FFunction · 0.85
SetUpMethod · 0.85

Calls 5

createMethod · 0.95
MeshClass · 0.90
IOErrorClass · 0.85
drop_zero_dimMethod · 0.80
MeshFactoryMethod · 0.45

Tested by 15

load_meshMethod · 0.68
TEST_FFunction · 0.68
SetUpMethod · 0.68
SetUpMethod · 0.68
TEST_FFunction · 0.68
load_fem_meshMethod · 0.68
load_fem_meshMethod · 0.68
load_fem_meshMethod · 0.68
load_settingMethod · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68