## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
• Create your own community
##### Activity
sariug
@sariug
how can we add a mesh to another mesh ?
hoosha
@hoosha
Use + to add two meshes!
mesh1 = mesh1 + mesh2
sariug
@sariug
hello, I was checkin the example of gauss curvature
gauss = np.array([discrete_gaussian_curvature_measure(mesh, mesh.vertices, r)/sphere_ball_intersection(1, r) for r in radii])
why is the division of sphere_ball_intersection ?
Tobias Vitt
@tobiasvitt
Hey, Is there a way to colorise a VoxelGrid? After applying voxelize(d) the colors of the mesh are gone.
Andrew Annex
@AndrewAnnex
hey all, I am running into an issue with ray.intersects_location returning much larger distances than expected between two meshes. I first use closest_point to find points on the lower surface of interest and the indexes for the normals. then use ray.intersects_location with those lower surface points using the closes face normals to those points from the index returned by closest_point. I can tell something is off because if I explicitly set the normals to be [0,0,1], ray.intersects_location return points with different x and y coordinates then the ray origins (the rays should be orthogonal to the xy axis plane). am I missing something?
sariug
@sariug
uh was gonan ask something but lets wait until the questions above are answered :)
ChrisGithubWork
@ChrisGithubWork
Hey at all,
i do have a question but i don't know if this is the right place.
I tried the voxel package and voxeled a lot of stuff. But now i wan't to digg deeper but i'm stuck now.
I want to extract the vertex information of every voxel, bacause i need them to manipulate the geometry. So i'm looking for something like: for voxel in allvoxels: give me voxel with his eight vertices. Is this possible?
ChrisCarragher
@ChrisCarragher
Hi, so I am just getting started with trimesh, is there some documentation I am missing or is it a matter of going through the code?
I am trying the basic example but with a 3mf file and I get "'Scene' object has no attribute 'is_watertight'", how do I import a 3mf as a mesh or how do I split/convert a Scene to a mesh? Thanks
Mihai ANDRIES
@science-code
Hello! After an update in scikit-image, pillow, I cannot generate mesh images anymore with Trimesh. Have you encountered this problem already?
Instead of a mesh image, it generates a print-screen.
@ChrisCarragher If your question is still open, I would export an mesh in STL format from your 3mf file, and then load this STL with Trimesh.
Michael Dawson-Haggerty
@mikedh
hey @ChrisCarragher a 3MF can contain multiple meshes, you can access them through scene.geometry or dump them all into a single mesh with scene.dump(concatenate=True)
@science-code were you using scene.save_image?
Mihai ANDRIES
@science-code
@mikedh I use this:
# Example: https://github.com/mikedh/trimesh/issues/115#issuecomment-351866100
data = mesh.scene().save_image(resolution=[1480,1480], visible=False)
rendered = Image.open(trimesh.util.wrap_as_stream(data))
rendered.show()
\$ pip show pillow
Version: 7.0.0
Required-by: scikit-image, imageio
Name: scikit-image
Version: 0.15.0
Name: imageio
Version: 2.8.0
Michael Dawson-Haggerty
@mikedh
hmm if anything I would suspect a recent pyglet upgrade for this
they released recently
Mihai ANDRIES
@science-code
@mikedh it seems that the error comes from this part:
data = scene.save_image(resolution=[480,480], visible=True) #False)
It works with "visible=True", but does not work with "visible=False".
Moreover, even with "visible=True", the first mesh image is completely black.
Mihai ANDRIES
@science-code
@mikedh Any ideas from where this might come?
Mihai ANDRIES
@science-code
Currently using this alternative, which has the same fault (every once in a while, a mesh image is just black):

### Alternative code for generating a mesh-image

from trimesh import viewer as trimesh_viewer

### ...

data = trimesh_viewer.render_scene(mesh.scene(), resolution=[480,480], visible=True)

I suppose it also slows down image generation, due to "visible=True".
ChrisCarragher
@ChrisCarragher
@mikedh Thank you!
Mihai ANDRIES
@science-code
@mikedh I would be grateful for any suggestion you may have :-)
Michael Dawson-Haggerty
@mikedh
Hey, whether visible=False works depends a lot on your platform: mikedh/trimesh#125
Jason McInerney
@wwwslinger
Hi. I can't find this anywhere, but my goal is to take an STL of a non-uniformly curved surface and determine how to cut a flat sheet to cover it with as few segments as possible. Any thoughts on how to approach it using trimesh?
Mihai ANDRIES
@science-code
@wwwslinger if your object is convex, you could use a convex envelope.
@wwwslinger another alternative would be to simplify the mesh while enforcing constraints on its surface. You can use the "Decimate" function of MeshLabServer for this.
@mikedh It used to work with visible=False, but stopped since I installed some python packages. The platform is the same as before, so this isn't the issue. I've tried to identify which python package broke the mesh-image generation, but in vain.
Jason McInerney
@wwwslinger
It is convex @science-code , thanks. Simplifying would be cool, too, since it does has some structure past the surface edges that I need to somehow cut off
@science-code I can seem to find Decimate in there, just ParaDecimate -- is that the same? Do you have link to an example perhaps?
Mihai ANDRIES
@science-code
@wwwslinger here's a python code that does the simplification down to 2000 triangles in the final mesh:

You need to install meshlab for that work.
To change the number of triangles in the final mesh, edit the value on line 21:

<Param type="RichInt" value="2000" name="TargetFaceNum"/>

Jason McInerney
@wwwslinger
@science-code thanks for the script. I tested it out, but am getting a not found for the Remove Unreferenced Vertex Filter. Is there a default somewhere that I can plug in?
Mihai ANDRIES
@science-code
@wwwslinger Try to remove that line, it will probably work without it.
To have the exact code for any operation on the mesh in MeshLab, go to "Filter > Show current filter script".
See the exact name of the operation in your version of MeshLab, as use that one instead.
Those filters are just for cleaning the mesh.
Giacomo Vianello
@giacomov
Hi, I am looking for a simple way to solve this problem in python: I have a mesh of a roof. The real object is composed of planes intersecting at sharp angles. However, the mesh I have has several thousand faces. I am looking for a way to merge all adjacent faces whose normals are within a certain angle. In other words, I want to merge all nearly coplanar faces. Is there a trimesh way of doing this? I was looking at trimesh.grouping.group_vectors, but I don't know how to enforce connectivity and also I don't know how to merge the groups.
jaredsagendorf
@jaredsagendorf
Hello all, I want to compute the mean/gaussian curvature over a mesh and I'm looking at the curvature.ipynb example with the following code: discrete_gaussian_curvature_measure(mesh, mesh.vertices, r)/sphere_ball_intersection(1, r)
But I don't really understand what the sphere_ball_intersection(1,r) call is about... what exactly is this example showing? Can I use this to calculate curvature at every vertex for an arbitrary mesh? How would I know what value of r to use?
PedroLopes211
@PedroLopes211
Hello. For my project, I need to measure the distance between two STL files. I wrote a script that allows reading the files, positioning them in relation to each other in the desired position . I saw the module Trimesh.collision because it looks like a mesh - mesh comparer . So I tried to use min_distance_single to "get the minimum distance between any pair of objects, one in each manager" but I receive and error like this
I tried to upload a mesh from a .stl file (ASCII) . I discover this library recently, is there a module that can make me discover the distance between those two objects? I also wrote the question here: https://stackoverflow.com/questions/61159587/measure-distance-between-meshes?noredirect=1#comment108198970_61159587
Jose Juan Montes
@jjmontesl
Hi there. Just sharing something I'm working on that uses Trimesh: