3DLIRIOUS / MeshLabXML

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

Save individual layers as individual file #37

Open BKillen05 opened 1 year ago

BKillen05 commented 1 year ago

I am currently trying to replicate a set of steps which I can do in the GUI using Meshlab XML.

Essentially I load a geometry - then use the "Compute Planar Section " to section this geometry.

I have (I think) succesfully replicated this using meshlabxml however when I check my output file it is not the "cut" version.

My Code:

import meshlabxml as mlx
import os

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

compSurf  = mlx.FilterScript(file_in = 'femur-bone.stl', file_out= '3D_project_auto.stl', ml_version = '2016.12')
mlx.compute.section(compSurf, axis='x' , surface=True)
compSurf.run_script()

I have checked that the current layer is in fact the surface I want to save by adding a print statement in compute.section : print(script.layer_stack[script.current_layer()]) which returns the layer I want - however again the output file does not reflect this.

I have also tried to delete the remaining layers to only have this layer left using. Note this was added in in compute.section function following the new surface being added as new layer.

script.del_layer(0)
script.del_layer(1)

Is there something glaring which I am missing ?

Thank you in advance.