Reputation: 21
I just started using pymeshlab and am really enjoying it. I am having trouble with one thing, however. I'm trying to use the vertex_attribute_transfer
filter, but would rather use a world unit rather than a percentage for the upperbound parameter. I figured I would be able to calculate the correct percentage for the parameter based off my desired world unit divided by diagonal length of the bounding box x100, but I cannot figure out how to get the bounding box info for a mesh in the MeshSet.
I see the compute_geometric_measures
tool is supposed to provide bounding box info based off the documentation, but a dictionary with other information related to the mesh is the result (like average edge length, area, etc -- which is still useful info). I also see that there is an entire bounding box class, but I don't know how to use it to get the bounding box info for a specific mesh in the MeshSet.
Could some one please provide an example getting the bounding box info for a mesh in pymeshlab?
Upvotes: 1
Views: 1684
Reputation: 3240
I will extend the original answer given by Phil Devine to give a complete executable example. This example read a mesh and calls the diagonal() method.
import pymeshlab as ml
ms = ml.MeshSet()
ms.load_new_mesh('input.ply')
m = ms.current_mesh()
#Build the Bounding Box and get its diagonal length
diag = m.bounding_box().diagonal()
print('Diagonal of this model:', diag)
Upvotes: 1
Reputation: 21
Figured out how to get bounding box info. For anyone wondering, it looks like this:
boundingbox = ms.current_mesh().bounding_box()
diag = boundingbox.diagonal()
Upvotes: 1