Skip to content

how to get vertices coordinates for the given mesh in meshlib #3256

Answered by Grantim
dhanraj-khatal asked this question in Q&A
Discussion options

You must be logged in to vote

Hello!

There are at least three ways to get vertices coordinates:

  1. Iterate over valid vertices and read coordinates:
from meshlib import mrmeshpy as mm
mesh = mm.loadMesh("some_mesh.stl")
# no need to pack here because we iterate over valid vertices only
for v in mesh.topology.getValidVerts():
    coord = mesh.points.vec[v.get()]
    print ( coord.x, coord.y, coord.z )
  1. Take all vertices coordinates (even invalid ones, e.g. removed from mesh but still present in list while may be not packed) as list of mrmeshpy.Vector3f
from meshlib import mrmeshpy as mm
mesh = mm.loadMesh("some_mesh.stl")
# stl files are always packed, but if you did some operations you might need to pack mesh to elimi…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dhanraj-khatal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants