Hammad Mansoor
Hammad Mansoor

Reputation: 31

Writing to .ply files using python

I am using the PlyFile library (https://pypi.org/project/plyfile) in Python. I used vertex = plydata['vertex'] to generate a list of vertex co-ordinates. The datatype is as follows - PlyElement('vertex', (PlyProperty('x', 'float'), PlyProperty('y', 'float'), PlyProperty('z', 'float')), count=2500086, comments=[])

After that I generated a list of all the x-axis values and put them into a numpy array and performed some operations on them. Then I replaced the original x-axis values in plydata['vertex'] with these new ones.

Now I want to write these values into a .ply file and create a new mesh. How would I go about it? I tried going through the docs but the code is quite messy.

Any insights would help, Thanks!

Upvotes: 0

Views: 2120

Answers (1)

Mark Loyman
Mark Loyman

Reputation: 2180

Saving a .ply file:

ply_data: PlyData
ply_data.text = True  # for asci format
ply_data.write(path)

Upvotes: 0

Related Questions