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.

In every non-empty MeshSet, there is a current mesh, that can be accessed using the method pmeshlab.MeshSet.current_mesh().

From the MeshSet class, you can apply all the filters of MeshLab by calling the associated methods. In this page are listed all the methods of the MeshSet class except the methods associated to filters. For the list of these methods, please refer to the List of Filters page. Sometimes, filters change the current mesh when applied, setting it to their output. The behaviour is always the same of MeshLab.

Note that the MeshSet class is not thread safe: it is not safe to run multiple filters in parallel on the same MeshSet object.

class pmeshlab.MeshSet
show_polyscope() None

Shows a polyscope window (https://polyscope.run/py/) of the current MeshSet, rendering all the meshes contained in it. Requires the polyscope package (pip install polyscope).

__getitem__(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.

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

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

__iter__(self: pmeshlab.MeshSet) Iterator
__len__(self: pmeshlab.MeshSet) int

This function is deprecated. Returns the number of meshes contained in the MeshSet.

__str__(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.)

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. If the name argument is left empty, the newly added mesh will have the same name of the mesh argument.

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 mesh of the MeshSet. Raises a PyMeshLabException if the MeshSet has no current mesh (zero meshes).

current_mesh_id(self: pmeshlab.MeshSet) int

Returns the id of the current mesh of the MeshSet. Raises a PyMeshLabException if the MeshSet has no current mesh (zero meshes).

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. This function works also for the ‘save mesh’ functions, just giving the format of the file as parameter instead of the filter name. This is useful for example when saving into a format that supports exporting custom parameters, which may have names that can be known only at runtime.

is_current_mesh_visible(self: pmeshlab.MeshSet) bool

Returns a boolean indicating whether the current mesh is visible or not.Raises a PyMeshLabException if the MeshSet has no current mesh (zero meshes).

is_mesh_visible(self: pmeshlab.MeshSet, id: int) bool

Returns a boolean indicating whether the mesh with the given ID is visible or not.Raises a PyMeshLabException if the given ID is not found in the MeshSet.

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 one. This method accepts a list of parameters that depends on the format of the file that is being loaded. The list of possible parameters is listed in the :load mesh parameters page. 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 one. This method accepts a list of parameters that depends on the format of the file that is being loaded. The list of possible parameters is listed in the load raster parameters page. 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: object) None

Loads a project from the given file name(s) and stores it in the MeshSet. This function can accept a string as a single filename, or a list of strings if the project is composed of more than one file. E.g. ms.load_project(['bundle.rd.out', 'cams.txt']).

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.

mesh_number(self: pmeshlab.MeshSet) int

Returns the number of meshes contained in the MeshSet.

number_meshes(self: pmeshlab.MeshSet) int

This function is deprecated. Returns the number of meshes contained in the MeshSet.

number_rasters(self: pmeshlab.MeshSet) int

This function is deprecated. Returns the number of rasters contained in the MeshSet.

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.)

raster_number(self: pmeshlab.MeshSet) int

Returns the number of rasters contained in the MeshSet.

save_current_mesh(self: pmeshlab.MeshSet, file_name: str, save_textures: bool = True, texture_quality: int = -1, **kwargs) None

Saves the current mesh in the MeshSet in a file having the given file name. This method accepts a list of parameters that depends on the format of the file that is being saved. The list of possible parameters is listed in the save mesh parameters page. 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_current_mesh_visibility(self: pmeshlab.MeshSet, visibility: bool) None

Sets the visibility of the current mesh according to the given boolean argument.Raises a PyMeshLabException if the MeshSet has no current mesh (zero meshes).

set_mesh_visibility(self: pmeshlab.MeshSet, id: int, visibility: bool) None

Sets the visibility of the mesh with the given ID according to the given boolean argument.Raises a PyMeshLabException if the given ID is not found in the MeshSet.

set_parameter_verbosity(self: pmeshlab.MeshSet, verbosity: bool) None

Sets the verbosity of the MeshSet, regarding only the print of the parameters when running afilter. When set to true, only the parameters of the filter with their values will be printed when a filter is executed. Other messages are not printed.

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, along with other messages, are printed when filters are applied.