-
Hi, I'v been trying to use this library to convert my files' x, y, z, nx, ny, nz from
To clarify my questions after you read my script below:
thank you in advance!
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Maybe this is oversimplified for your use case, but here's an example of what I think you want. In this one, I'm converting "x", "y", and "z" from float to double. from plyfile import PlyData
data = PlyData.read('examples/tet.ply')
new_types = {
'x': 'double',
'y': 'double',
'z': 'double',
}
for prop in data['vertex'].properties:
if prop.name in new_types:
prop.val_dtype = new_types[prop.name]
data.write('test.ply')
data = PlyData.read('test.ply')
print(data['vertex'].data)
print(data['vertex'].data.dtype) It should be enough simply to change the types in the |
Beta Was this translation helpful? Give feedback.
Maybe this is oversimplified for your use case, but here's an example of what I think you want. In this one, I'm converting "x", "y", and "z" from float to double.
It should be enough simply to change the types in the
PlyProperty
metadata, which will force the data to be cast when writing. If that works for you, it's p…