how to get vertices coordinates for the given mesh in meshlib #3256
Answered
by
Grantim
dhanraj-khatal
asked this question in
Q&A
-
I want to get the coordinate point of all vertices of processed mesh is there any way to get the coordinate in meshlib |
Beta Was this translation helpful? Give feedback.
Answered by
Grantim
Aug 29, 2024
Replies: 1 comment
-
Hello! There are at least three ways to get vertices 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 )
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 eliminate invalid vertices from `points`
# mesh.pack()
points = mesh.points.vec # this data type can be used as standard python list
from meshlib import mrmeshpy as mm
from meshlib import mrmeshnumpy as mn
import numpy as np
mesh = mm.loadMesh("some_mesh.stl")
# stl files are always packed, but if you did some operations you might need to pack mesh to eliminate invalid vertices from `points`
# mesh.pack()
vertsNP = mn.getNumpyVerts( mesh ) # same as `mn.toNumpyArray( mesh.points )` or `mn.toNumpyArray( mesh.points.vec )` |
Beta Was this translation helpful? Give feedback.
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
Hello!
There are at least three ways to get vertices coordinates: