Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 1.76 KB

filter_scripts.rst

File metadata and controls

41 lines (28 loc) · 1.76 KB

Filter Scripts

Introduction

PyMeshLab supports "Filter Scripts": scripts generated by MeshLab that allow to automatically execute a list of filters with user-defined parameters. These scripts were supported by meshlabserver, the tool used for MeshLab batch processing. To generate a filter script using MeshLab is quite easy: after you applied all the desired filters, go to "Filters -> Show current filter script". A dialog containing the list of all the applied filters will appear. You can edit the order of the filters and their parameters, and then save the filter script. Then, you can use the saved script to apply the list of filters to other meshes using PyMeshLab.

Apply a Filter Script

In PyMeshLab, every :ref:`meshset` object stores internally a filter script: you can always save its script that will contain all the applied filters with their parameters:

import pymeshlab
ms = pymeshlab.MeshSet()
ms.load_new_mesh('input.obj')
ms.apply_coord_laplacian_smoothing(stepsmoothnum=10)
#apply some other filters....

#.. and then save the script
ms.save_filter_script('my_script.mlx')

You can then apply all the filters of the script to another input mesh:

import pymeshlab
ms = pymeshlab.MeshSet()
ms.load_new_mesh('another_input.obj')
ms.load_filter_script('my_script.mlx')
ms.apply_filter_script()
ms.save_current_mesh('result.obj')

The :ref:`meshset` class provides methods that allow to load, save, clear and print a Filter Script. Check the documentation of the :ref:`meshset` class for more details.

For further details check the :ref:`filter_script_load_and_apply` and :ref:`filter_script_create_and_save` tutorials.