3DLIRIOUS / MeshLabXML

Create and run MeshLab XML scripts with Python
GNU Lesser General Public License v2.1
202 stars 43 forks source link

Ubuntu installation #25

Open ahmedmaalej opened 4 years ago

ahmedmaalej commented 4 years ago

I tried installation under ubuntu for python coding, using a virtual environment and followed the steps, I tried adding the meshlabserver using these lines:

MESHLABSERVER_PATH = '/usr/bin/'
os.environ['PATH'] += os.pathsep + MESHLABSERVER_PATH

with example#1 but I keep gettting this error MSG:

if script.ml_version == '1.3.4BETA':

AttributeError: 'str' object has no attribute 'ml_version'

Any idea

3DLIRIOUS commented 4 years ago

That example code is quite old and predates the introduction of the FilterScript class. What version of MLX are you running? Try the example code on Github instead, i.e.:

import meshlabxml as mlx

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=[0, 5.0, 0])
orange_cube.run_script()

You should not need to explicitly set the meshlabserver path in your script if it is already in your system path.