MeshSet

The MeshSet class represents a container that allows to collect a set of Meshes, where every Mesh corresponds to a layer of MeshLab. Every mesh has an unique ID that identifies it inside the MeshSet. From the MeshSet class, you can apply all the filters of MeshLab by calling the pmeshlab.MeshSet.apply_filter() method.

In every non-empty MeshSet, there is a current mesh, that can be accessed using the method pmeshlab.MeshSet.current_mesh(). Sometimes, filters change the current mesh when applied, setting it to their output. The behaviour is always the same of MeshLab.

class pmeshlab.MeshSet
__init__(self: pmeshlab.MeshSet, verbose: bool = False) → None

Initializes a MeshSet, setting the verbosity with the given value (default is False).

add_mesh(self: pmeshlab.MeshSet, mesh: pmeshlab.Mesh, mesh_name: str = '', set_as_current: bool = True) → None

Adds a copy of the given mesh in the current MeshSet, with the given name. By default, the added mesh will be set as the current mesh. This behaviour can be changed by setting the arg set_as_current to False.

apply_filter(self: pmeshlab.MeshSet, filter_name: str, **kwargs) → dict

Applies the filter having the given filter name in the MeshSet. Updates the current filter script, pushing the applied filter with the given parameters. Returns a dictionary containing pairs of [string - value] returned by the applied filter. See the List of Filters page to a list of all the possible filters that can be applied using this function.

apply_filter_script(self: pmeshlab.MeshSet) → None

Applies all the filters currently present in the filter script.

clear(self: pmeshlab.MeshSet) → None

Clears the meshset, deleting all its content.

clear_filter_script(self: pmeshlab.MeshSet) → None

Clears the current filter script.

current_mesh(self: pmeshlab.MeshSet) → pmeshlab.Mesh

Returns the current selected mesh of the MeshSet. Raises a PyMeshLabException if the MeshSet has no selected mesh.

current_mesh_id(self: pmeshlab.MeshSet) → int

Returns the id of the current selected mesh of the MeshSet. Raises a PyMeshLabException if the MeshSet has no selected mesh.

filter_parameter_values(self: pmeshlab.MeshSet, arg0: str, **kwargs) → dict

Returns a dictionary containing the parameters and their values that would be used by the given filter if the ‘apply_filter’ function is called in the current MeshSet. This function is useful to check which default values are set with the current status of the MeshSet. It takes also a (possibly empty) dictionary of parameters that could be set by the user: in this case, the output value of these parameters should be the same as input.

load_current_mesh(self: pmeshlab.MeshSet, file_name: str, **kwargs) → None

Loads the mesh in the given filename and overwrites the current selected mesh. The loaded mesh remains the current selected one. Raises a PyMeshLabException if the file is not found, if the format of the file is not known by PyMeshLab or if there was an error while loading the file.

load_filter_script(self: pmeshlab.MeshSet, filter_script_name: str) → None

Loads from a .mlx file the current filter script.

load_new_mesh(self: pmeshlab.MeshSet, file_name: str, **kwargs) → None

Loads the mesh in the given filename and adds the mesh in the MeshSet. The loaded mesh becomes the current selected one. Raises a PyMeshLabException if the file is not found, if the format of the file is not known by PyMeshLab or if there was an error while loading the file.

load_new_raster(self: pmeshlab.MeshSet, file_name: str) → None

Loads the raster in the given filename and adds the raster in the MeshSet. The loaded raster becomes the current selected one. Raises a PyMeshLabException if the file is not found, if the format of the file is not known by PyMeshLab or if there was an error while loading the file.

load_project(self: pmeshlab.MeshSet, file_name: str) → None

Loads a project from the given file name and stores it in the MeshSet.

mesh(self: pmeshlab.MeshSet, id: int) → pmeshlab.Mesh

Returns a reference to the mesh having the given id in the MeshSet. Raises a PyMeshLabException if the given ID is not found in the MeshSet.

mesh_id_exists(self: pmeshlab.MeshSet, id: int) → bool

Returns true if the given id exists in the MeshSet.

number_meshes(self: pmeshlab.MeshSet) → int

Returns the number of meshes contained in the MeshSet.

number_rasters(self: pmeshlab.MeshSet) → int

Returns the number of rasters contained in the MeshSet.

print_filter_list(self: pmeshlab.MeshSet) → None

Prints the list of all the filters that can be applied in the MeshSet.

print_filter_parameter_list(self: pmeshlab.MeshSet, filter_name: str) → None

Prints the list of the parameters of the given filter, with their default values.

print_filter_script(self: pmeshlab.MeshSet) → None

Prints all the filters present on the current filter script, with all the parameters and their values.

print_status(self: pmeshlab.MeshSet) → None

Prints the status of the MeshSet (number of meshes, and for every mesh its ID, its label and its full name.)

save_current_mesh(self: pmeshlab.MeshSet, file_name: str, **kwargs) → None

Saves the current selected mesh in the MeshSet in a file having the given file name. Raises a PyMeshLabException if the MeshSet has no current selected mesh, if the format of the file is not known by PyMeshLab or if there was an error while writing the file.

save_filter_script(self: pmeshlab.MeshSet, filter_script_name: str) → None

Saves in a .mlx file the current filter script.

save_project(self: pmeshlab.MeshSet, file_name: str) → None

Saves the content of the MeshSet in a file having the given file name.

set_current_mesh(self: pmeshlab.MeshSet, new_curr_id: int) → None

Selects as current mesh the mesh having the given ID. Raises a PyMeshLabException if the given ID is not found in the MeshSet.

set_verbosity(self: pmeshlab.MeshSet, verbosity: bool) → None

Sets the verbosity when using the MeshSet class. When set to true, all the logs that usually are printed in the bottom left of MeshLab, will be printed when filters are applied.