![]() is_watertight # what's the euler number for the mesh? mesh. load ( './models/featuretype.STL' ) # is the current mesh watertight? mesh. load ( 'models/CesiumMilkTruck.glb', force = 'mesh' ) # mesh objects can be loaded from a file name or from a buffer # you can pass any of the kwargs for the `Trimesh` constructor # to `trimesh.load`, including `process=False` if you would like # to preserve the original loaded data without merging vertices # STL files will be a soup of disconnected triangles without # merging vertices however and will not register as watertight mesh = trimesh. # if you *always* want a straight `trimesh.Trimesh` you can ask the # loader to "force" the result into a mesh through concatenation mesh = trimesh. Trimesh ( vertices =, , ], faces = ], process = False ) # some formats represent multiple meshes with multiple instances # the loader tries to return the datatype which makes the most sense # which will for scene-like files will return a `trimesh.Scene` object. Trimesh ( vertices =, , ], faces = ]) # by default, Trimesh will do a light processing, which will # remove any NaN values and merge vertices that share position # if you want to not do this on load, you can pass `process=False` mesh = trimesh. attach_to_log () # mesh objects can be created from existing faces and vertex data mesh = trimesh. import numpy as np import trimesh # attach to logger so trimesh messages will be printed to console trimesh. Also check out the cross section example. Ipython notebook version of this example. Here is an example of loading a mesh from file and colorizing its faces. To install trimesh with the soft dependencies that generally install cleanly on Linux, OSX, and Windows using pip: pip install trimesh įurther information is available in the advanced installation documentation. This includes things like convex hulls ( scipy), graph operations ( networkx), faster ray queries ( pyembree), vector path handling ( shapely and rtree), XML formats like 3DXML/XAML/3MF ( lxml), preview windows ( pyglet), faster cache checks ( xxhash), etc. More functionality is available when soft dependencies are installed. The minimal install can load many supported formats (STL, PLY, GLTF/GLB) into numpy arrays. For the easiest install with just numpy, pip can generally install trimesh cleanly on Windows, Linux, and OSX: pip install trimesh ![]() Installing other packages adds functionality but is not required. Keeping trimesh easy to install is a core goal, thus the only hard dependency is numpy. Here's a quick development and contributing guide. Pull requests are appreciated and responded to promptly! If you'd like to contribute, here is an up to date list of potential enhancements although things not on that list are also welcome. The API is mostly stable, but this should not be relied on and is not guaranteed: install a specific version if you plan on deploying something using trimesh. The goal of the library is to provide a full featured and well tested Trimesh object which allows for easy manipulation and analysis, in the style of the Polygon object in the Shapely library. ![]() Trimesh is a pure Python 3.7+ library for loading and using triangular meshes with an emphasis on watertight surfaces.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |