Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    Tobias Vitt
    Hey, Is there a way to colorise a VoxelGrid? After applying voxelize(d) the colors of the mesh are gone.
    Andrew Annex
    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?
    uh was gonan ask something but lets wait until the questions above are answered :)
    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?
    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
    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
    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
    @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))
    $ 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
    hmm if anything I would suspect a recent pyglet upgrade for this
    they released recently
    Mihai ANDRIES
    @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
    @mikedh Any ideas from where this might come?
    Mihai ANDRIES
    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".
    @mikedh Thank you!
    Mihai ANDRIES
    @mikedh I would be grateful for any suggestion you may have :-)
    Michael Dawson-Haggerty
    Hey, whether visible=False works depends a lot on your platform: mikedh/trimesh#125
    Jason McInerney
    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
    @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
    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
    @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
    @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
    @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
    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.
    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?
    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
    Captura de ecrã 2020-04-13, às 11.19.46.png
    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
    Hi there. Just sharing something I'm working on that uses Trimesh:
    Hi, I am just wondering if anyone has any recommends as to how to create an interactive UI with trimesh. I want a user to be able to open a file containing multiple meshes, display the meshes and have the user select one. Currently, I can open the file and modify meshes and extract information and show meshes I'm just not sure how I would allow a user to select one. Any help would be much appreciated.
    Michael Dawson-Haggerty
    hey you might check out the glooey widget example: https://github.com/mikedh/trimesh/blob/master/examples/widget.py
    Hi all! I have a problem where I need to take a mesh "A" and divide it into 3 smaller, seperate meshes. I am slightly overwhelmed by the documentation and I am not sure which trimesh functions should I be using for this task. I've discovered graph.Split() (which reduced the amount of original vertices..?), Submesh() or trimesh.remesh.Subdivide()
    Also is the functionality available which allows to specify the number parts in which I want to subdivide my mesh? example 3, 4 or 5 equal parts?