|
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! |
Answered by
dranjan
Jul 29, 2023
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 |
1 reply
Answer selected by
SyZbidi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
PlyPropertymetadata, which will force the data to be cast when writing. If that works for you, it's p…