Code Monkey home page Code Monkey logo

Comments (3)

Fedr avatar Fedr commented on June 14, 2024

Hello,

We have an example how to create new mesh object from two arrays of vertices and faces in the documentation: https://meshinspector.com/MeshLib/doc/HowToBasic.html#PythonCodeExamples

import meshlib.mrmeshpy as mrmeshpy
import meshlib.mrmeshnumpy as mrmeshnumpy
import numpy as np
 
faces = np.ndarray(shape=(2, 3), dtype=np.int32, buffer=np.array([[0, 1, 2], [2, 3, 0]], dtype=np.int32))
 
# mrmesh uses float32 for vertex coordinates
# however, you could also use float64
verts = np.ndarray(shape=(4, 3), dtype=np.float32, buffer=np.array([[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [1.0, 1.0, 0.0], [0.0, 1.0, 0.0]], dtype=np.float32))
 
mesh = mrmeshnumpy.meshFromFacesVerts(faces, verts)

Does it work for you?

from meshlib.

marios-stam avatar marios-stam commented on June 14, 2024

Hello, and thank you for the quick response.

The solution provided partially addressed my issue, but I've observed an anomaly.

I'm encountering a situation where the mesh, generated from another library, is not entirely watertight. As you suggested, I'm loading it as a meshLib object and attempting to fill in the gaps using the recommended method, but without success.

Interestingly, saving the mesh as a .stl file and then loading it back using meshlib seems to resolve the issue, as it becomes watertight afterward.

It appears that there are additional functionalities available when loading a mesh from an .stl file compared to simply loading it from a list of vertices and faces.

Do you maybe have any idea how to address this?

from meshlib.

Fedr avatar Fedr commented on June 14, 2024

In STL files, there are no vertex IDs stored, but only coordinates of vertices. So if you had two distinct vertices with equal coordinates before saving them in STL format, then after loading the mesh from this STL, such vertices will unite in one. This may explain your observations.

You can also try mrmeshpy.uniteCloseVertices function to solve your not-watertight meshes.

If nothing helps, please send an example of such mesh to us for better understanding of the problem.

from meshlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.