Can you please tell how to get the vertices/nodes/points values from the mesh loaded using shapeworks? In below screenshot I can get the number of particles but how to get the values of particles?
You can use points()
and faces()
>>> mesh.points()
array([[-103.06400299, -251.03999329, 41.98860168],
[-102.5 , -251.11300659, 41.96179962],
[-102. , -251.09199524, 41.96450043],
...,
[ -91. , -238. , 151.08700562],
[ -90.5 , -238. , 151.09599304],
[ -90. , -238. , 151.09100342]])
>>> mesh.faces()
array([[ 4, 5, 0],
[ 1, 0, 5],
[ 5, 6, 1],
...,
[75810, 75809, 80993],
[80993, 80994, 75810],
[75811, 75810, 80994]], dtype=int32)
You can explore the class using dir()
:
>>> import shapeworks as sw
>>> dir(sw.Mesh)
['Affine', 'AlignmentType', 'Butterfly', 'CurvatureType', 'DistanceMethod', 'Face', 'FieldType', 'Gaussian', 'Loop', 'Mean', 'Point', 'PointToCell', 'PointToPoint', 'Principal', 'Rigid', 'Similarity', 'SubdivisionType', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__iadd__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'applySubdivisionFilter', 'applyTransform', 'boundingBox', 'center', 'centerOfMass', 'clip', 'clipClosedSurface', 'closestPoint', 'closestPointId', 'compareField', 'computeNormals', 'computeThickness', 'copy', 'coverage', 'createTransform', 'curvature', 'distance', 'faces', 'fillHoles', 'fixElement', 'geodesicDistance', 'getFace', 'getField', 'getFieldNames', 'getFieldValue', 'getMultiFieldValue', 'getPoint', 'interpolateFieldAtPoint', 'interpolate_scalars_to_mesh', 'invertNormals', 'numFaces', 'numPoints', 'points', 'probeVolume', 'reflect', 'remesh', 'remeshPercent', 'rotate', 'scale', 'setField', 'setFieldValue', 'smooth', 'smoothSinc', 'toDistanceTransform', 'toImage', 'translate', 'write']