I very recently started working with processing 3D objects starting off from files obtained from a 3D scanner. I want to automate the volume calculation (and some other metrics) for my colleagues as this otherwise would become too time-consuming.
In the script, the raw output files (.stl) are read using pymeshlab, split using KMeans clustering, ordered (from top left to bottom right), and further processed. For the splitting, I currently have an array containing the vertices of the different items (indicated by 'true/false' or a number (e.g., 1-n)). I now want to use 'compute_selection_by_condition_per_vertex
' as indicated here (How to select an array of vertices in pymeshlab?) but with the condition that all vi (vertex indices) that are not in the array should be selected and removed (using 'm.meshing_remove_selected_vertices()
'). The problem is that I don't seem to get the condition right.
# Compiling array containing the indices of the vertices of a cluster (tria)
vi_tria = []
for tria_i,tria_x in enumerate(df['cluster']):
if tria_x != 1:
vi_tria.append(tria_i)
# Selecting the vertices in the loaded/selected mesh (tot_mesh) using the array of indices
tot_mesh.compute_selection_by_condition_per_vertex(condselect= "vi==vi_tria")
When running this, I get the error:
pymeshlab.pmeshlab.PyMeshLabException: Failed to apply filter: compute_selection_by_condition_per_vertex Details: Unexpected token "[] " found at position 4.
I've also tried to put it in a for loop but then PyCharm crashes and I can't find a solution elsewhere on the internet (after already quite some searching). Any help on how I can continue with only a part of the mesh to perform a surface reconstruction on (as there will be a hole in the mesh) afterward would be greatly appreciated!