0

I am doing a project in which I use meshlab with meshlabxml. Our scanner is producing a .txt file looking like this:

27.031334;20.715153;134.196397;
27.031334;20.715153;134.050344;
26.746812;20.426882;134.038013;

Every line represents a point. In meshlab importing a mesh from .txt file is possible and works great. I do not know how to import a mesh using meshlabxml. I know that the purpose of meshlabxml is to process filter files but I am not an expert. Is there any other library that can do the same thing?

1 Answers1

1

I have not used MeshLabXml ever but from reading the documentation i think that this example can help you. Just read your text file, split the ';' and give the values to to meshlab like this.

import meshlabxml as mlx

with open('your_txt_file.txt', 'r') as f:
    lines = f.readlines()

for line in lines:
    points = line.split(';')
    orange_cube = mlx.FilterScript(file_out='orange_cube.ply', ml_version='2016.12')
    mlx.create.cube(orange_cube, size=[3.0, 4.0, 5.0], center=True, color='orange')
    mlx.transform.rotate(orange_cube, axis='x', angle=45)
    mlx.transform.rotate(orange_cube, axis='y', angle=45)
    mlx.transform.translate(orange_cube, value=[points[0], points[1], points[2]])
    orange_cube.run_script()
Kostas Charitidis
  • 2,991
  • 1
  • 12
  • 23
  • Meshlabxml creates filter script for the whole file. It is possible to declare file_in but it doesn't work in my case, but thanks for help – Maks Grabowy Aug 14 '19 at 10:39