agrobot_base/Python/mesh_simplify/ply_to_obj.py

18 lines
624 B
Python

import pymeshlab
def convert_ply_to_obj(input_file, output_file):
# Carrega o arquivo PLY usando pymeshlab
ms = pymeshlab.MeshSet()
ms.load_new_mesh(input_file)
# Salva como arquivo OBJ, mantendo as cores
ms.save_current_mesh(output_file, save_textures=True)
print(f"Conversão concluída. Arquivo OBJ salvo em: {output_file}")
if __name__ == "__main__":
input_file = 'montagem_ply.ply' # Substitua pelo caminho do seu arquivo PLY de entrada
output_file = 'montagem_obj.obj' # Substitua pelo caminho do seu arquivo OBJ de saída
convert_ply_to_obj(input_file, output_file)