question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to load/get only the surface of a solidified mesh

See original GitHub issue

Hi Marco,

I have a mesh which also has internal fragmentation but as far as I know it is not tetrahedralized and it is a normal .obj file (see attached). image

I want to load it or after load to get only the surface structure and ignore the internal points/faces. I’ve tried to use the .tomesh(fill=False) method but apparently there isn’t anything relevant for the Mesh class. Thus, is there any other efficient way (build in function, I would prefer it from looping over the points and checking whether the point is inside the mesh) to do that.

Thanks piece_1.zip .

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
RubendeBruincommented, Oct 10, 2022

you may want to have a look at meshlab as well: https://www.meshlab.net/

there are python bindings (pymeshlab) which are really easy to combine with vedo as the data-structure is identical:

# from vedo to pymeshlab
ms = pymeshlab.MeshSet()
mesh = pymeshlab.Mesh(vertices, faces)
ms.add_mesh(mesh)

# and back
vertices = ms.current_mesh().vertex_matrix()
faces = ms.current_mesh().face_matrix()

m2 = vedo.Mesh([vertices, faces])
p.add(m2, render=False)

I use it myself for boolean operations as they are more stable than the ones in vtk (https://github.com/RubendeBruin/pymeshup)

1reaction
ttsesmcommented, Oct 10, 2022

Actually I never looked into open3d!

Ok, then maybe I’ve seen it somewhere else… 🤔

Anyways, actually I’ve created the following functions in case you are interested to add them. It is as simple as that:

import vedo as vd
import open3d as o3d

def o3d2vedo(o3d_mesh):
    m = vd.Mesh([np.array(o3d_mesh.vertices), np.array(o3d_mesh.triangles)])

    # you could also check whether normals and color are present in order to port with the above vertices/faces
    return m

and the counter function:

import vedo as vd
import open3d as o3d

def vedo2open3d(vd_mesh):
    """
    Return an `open3d.geometry.TriangleMesh` version of
    the current mesh.

    Returns
    ---------
    open3d : open3d.geometry.TriangleMesh
      Current mesh as an open3d object.
    """
    # create from numpy arrays
    o3d_mesh = o3d.geometry.TriangleMesh(
        vertices=o3d.utility.Vector3dVector(vd_mesh.points()),
        triangles=o3d.utility.Vector3iVector(vd_mesh.faces()))

    # I need to add some if check here in case color and normals info are not existing
    # o3d_mesh.vertex_colors = o3d.utility.Vector3dVector(vd_mesh.pointdata["RGB"]/255)
    # o3d_mesh.vertex_normals = o3d.utility.Vector3dVector(vd_mesh.pointdata["Normals"])

    return o3d_mesh
Read more comments on GitHub >

github_iconTop Results From Across the Web

Solidify Modifier — Blender Manual
The Solidify modifier takes the surface of any mesh and adds depth, thickness to it. ... Fill and Only Rim only make a...
Read more >
Solidify Modifier: how can I remove the inner mesh in a ...
Solidify Rim Only. Edit. See an example of an open area bellow where additional faces are created. Have you tried the Smooth modifier ......
Read more >
How to convert a mesh to a solid or surface body in Fusion 360
For a more in depth workflow (involving generating face groups), see the following steps: · Choose the mesh file to import. · Move...
Read more >
Autodesk Inventor: convert mesh features to surface or solids
Download the Mesh Enabler at the Autodesk Exchange Apps to convert the Mesh to an Inventor solid or composite surface: The Add-In will...
Read more >
How to repair a mesh in Blender - Artisticrender.com
Inverted normal · Zero area faces · Unconnected edges, vertices or faces · Loose geometry · Intersecting and self-overlapping geometry · Faces bending...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found