Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with script for smoothing #35

Open
e-dub opened this issue Dec 31, 2021 · 1 comment
Open

Problem with script for smoothing #35

e-dub opened this issue Dec 31, 2021 · 1 comment

Comments

@e-dub
Copy link

e-dub commented Dec 31, 2021

Hi, I have run into a problem (I had it working a couple years ago on another computer with another version of MeshLab, but now...) when trying to smooth an STL file with MeshLab controlled via MeshLabXML. Any ideas what I am doing wrong? Any help would be most appreciated!

My system:
Ubuntu 21.10
Python 3.9.7
MeshLab 2020.09
MeshLabXML 2021.7

The following Python code with MeshLabXML:

import meshlabxml as mlx

SmoothFn = mlx.FilterScript(file_in=FileIn, file_out=FileOut)
mlx.smooth.laplacian(
    SmoothFn,
    iterations=5,
    boundary=True,
    cotangent_weight=True,
    selected=False,
)
SmoothFn.run_script()

writes the following script:

<!DOCTYPE FilterScript>
<FilterScript>
  <filter name="Merge Close Vertices">
    <Param name="Threshold" value="0.0" description="Merging distance" min="0" max="1" type="RichAbsPerc" />
  </filter>
  <filter name="Change the current layer">
    <Param name="mesh" value="0" description="Mesh" type="RichMesh" />
  </filter>
  <filter name="Laplacian Smooth">
    <Param name="stepSmoothNum" value="5" description="Smoothing steps" type="RichInt" />
    <Param name="Boundary" value="true" description="1D Boundary Smoothing" type="RichBool" />
    <Param name="cotangentWeight" value="true" description="Cotangent weighting" type="RichBool" />
    <Param name="Selected" value="false" description="Affect only selected faces" type="RichBool" />
  </filter>
</FilterScript>

Doing the smoothing by "hand" in MeshLab gives me the following script:

<!DOCTYPE FilterScript>
<FilterScript>
 <filter name="Laplacian Smooth">
  <Param value="10" type="RichInt" name="stepSmoothNum"/>
  <Param value="true" type="RichBool" name="Boundary"/>
  <Param value="false" type="RichBool" name="cotangentWeight"/>
  <Param value="false" type="RichBool" name="Selected"/>
 </filter>
</FilterScript>

There seems to be some major differences in the naming, i.e.

  • Param value vs. value,
  • Param name vs. name.

For the sake of completeness, I get the following output with the error message:

meshlabserver cmd = meshlabserver -i "FileIn.stl" -o "FileOut.stl"  -s "/tmp/tmpzhanjw91.mlx"
***START OF MESHLAB STDOUT & STDERR***
Loading Plugins:
Current Plugins Dir is: /usr/lib/x86_64-linux-gnu/meshlab/plugins 
Total 266 filtering actions
Total 13 io plugins
Opening a file with extension stl
Mesh FileIn.stl loaded has 5912 vn 10048 fn
output mesh  FileOut.stl
Apply FilterScript: '/tmp/tmpzhanjw91.mlx'
FilterScript
Reading filter with name Merge Close Vertices
Reading filter with name Change the current layer
Reading filter with name Laplacian Smooth
Starting Script of 3 actionsfilter: Merge Close Vertices
LOG: 2 Successfully merged 0 vertices
Successfully merged 0 vertices
filter: Change the current layer
meshlabserver: ./src/meshlabserver/mainserver.cpp:614: bool MeshLabServer::script(MeshDocument&, const QString&, FILE*): Assertion `parameterSet.size() == required.size()' failed.
Aborted (core dumped)

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 "FileIn.stl" -o "FileOut.stl"  -s "/tmp/tmpzhanjw91.mlx""
Where do we go from here?

Thanks for providing this library! Great stuff.

@e-dub
Copy link
Author

e-dub commented Dec 31, 2021

see pull request

There is probably a better way though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant