3DLIRIOUS / MeshLabXML

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

MeshLab did not finish successfully #22

Closed MohamadZohoori closed 4 years ago

MohamadZohoori commented 4 years ago

Hi,

I wrote this code:

import meshlabxml as mlx

ashkan = mlx.FilterScript(file_out='Ashkanna.stl', ml_version='2016.12') Mesh = mlx.find_texture_files('Mohamadthefifth.stl', log = None) mlx.remesh.uniform_resampling(Mesh) ashkan.run_script()

But there was problem when i ran the code:

meshlabserver cmd = meshlabserver -i "C:\Users\lenovo\Desktop\python\tmp3gakster.xyz" -o "Ashkanna.stl" -s "C:\Users\lenovo\AppData\Local\Temp\tmp1hba5pti.mlx" START OF MESHLAB STDOUT & STDERR

Houston, we have a problem. MeshLab did not finish successfully. Review the log file and the input file(s) to see what went wrong. MeshLab command: "meshlabserver -i "C:\Users\lenovo\Desktop\python\tmp3gakster.xyz" -o "Ashkanna.stl" -s "C:\Users\lenovo\AppData\Local\Temp\tmp1hba5pti.mlx"" Where do we go from here? r - retry running MeshLab (probably after you've fixed any problems with the input files) c - continue on with the script (probably after you've manually re-run and generated the desired output file(s) x - exit, keeping the TEMP3D files and log xd - exit, deleting the TEMP3D files and log

Select r, c, x (default), or xd: x Exiting ... An exception has occurred, use %tb to see the full traceback.

Please help me find the problem.

Thanks in advance for your help.

KS-MA commented 4 years ago

I have a similar problem. Have you found a solution by now ?

MohamadZohoori commented 4 years ago

Yes, some of the codes do not actually work that way. I don't use scripts, I just work with the filters on meshlab software and save the filter scripts and then import the saved filters into my scripts. for example instead of using: mlx.remesh.uniform_resampling(Mesh) I apply the filter in meshlab software and save the filter in mlx format. then I import the .mlx file and the mesh and get the output file so easily.

    MESHLABSERVER_PATH = 'C:\\Program Files\\VCG\\MeshLab'
    os.environ['PATH'] += os.pathsep + MESHLABSERVER_PATH

    script = 'meshlabfilters.mlx' # script file
    log = 'notes.txt' # log file

    me = mlx.FilterScript(file_in = 'pointcloud.xyz',file_out='%s.stl'%name, ml_version='2016.12')
    me.run_script(log = log,script_file = script)
3DLIRIOUS commented 4 years ago

@MohamadZohoori There are several issues with your original code. Please read the documentation for each function. Most functions should have docstrings, if not please file an issue. Failing that, you can always take a look at the code.

ashkan = mlx.FilterScript(file_out='Ashkanna.stl', ml_version='2016.12')

You also need to define the "file_in" parameter. Later you attempt to run remesh.uniform_resampling, which needs an input mesh to work on.

Mesh = mlx.find_texture_files('Mohamadthefifth.stl', log = None)

mlx.find_texture_files returns a tuple, not a FilterScript object. This function finds the names of any associated texture and material files for a mesh, however there is no point in running it on an stl file, since the stl format does not support textures.

mlx.remesh.uniform_resampling(Mesh)

The parameter needs to be a FilterScript object, i.e. "ashkan"

The corrected code should look something like:

import meshlabxml as mlx

ashkan = mlx.FilterScript(file_in='input.stl', file_out='Ashkanna.stl', ml_version='2016.12')
mlx.remesh.uniform_resampling(ashkan)
ashkan.run_script()
kinger-ml commented 4 years ago

@MohamadZohoori There are several issues with your original code. Please read the documentation for each function. Most functions should have docstrings, if not please file an issue. Failing that, you can always take a look at the code.

ashkan = mlx.FilterScript(file_out='Ashkanna.stl', ml_version='2016.12')

You also need to define the "file_in" parameter. Later you attempt to run remesh.uniform_resampling, which needs an input mesh to work on.

Mesh = mlx.find_texture_files('Mohamadthefifth.stl', log = None)

mlx.find_texture_files returns a tuple, not a FilterScript object. This function finds the names of any associated texture and material files for a mesh, however there is no point in running it on an stl file, since the stl format does not support textures.

mlx.remesh.uniform_resampling(Mesh)

The parameter needs to be a FilterScript object, i.e. "ashkan"

The corrected code should look something like:

import meshlabxml as mlx

ashkan = mlx.FilterScript(file_in='input.stl', file_out='Ashkanna.stl', ml_version='2016.12')
mlx.remesh.uniform_resampling(ashkan)
ashkan.run_script()

Hi, I tried to apply this but this is not resulting in the resampled object as output. Instead, the input file is stored as output. I further checked the MLX script function from meshlab and used that to convert the object. Looks like when a new layer is added during the resampling operation, file_out operation simply takes the initial mesh layer and stores it as output file. Is there any work around for this. Let me know if I am overlooking anything.

Thanks.