Skip to content

centroid coordinates for holes #3532

Answered by Grantim
DMBabich asked this question in Q&A
Discussion options

You must be logged in to vote

Hello!

In older versions of meshlib python you could not call fillHoleTrivially manually, but after our latest release it is possible:

from meshlib import mrmeshpy

# Load mesh
mesh = mrmeshpy.loadMesh("untitled.stl")

# Find single edge for each hole in mesh
hole_edges = mesh.topology.findHoleRepresentiveEdges()

for e in hole_edges:
    #  Setup filling parameters
    params = mrmeshpy.FillHoleParams()
    params.metric = mrmeshpy.getUniversalMetric(mesh)
    #  Fill hole represented by `e`
    centroidV = mrmeshpy.fillHoleTrivially(mesh, e)
    mesh.points.vec[centroidV.get()].z -= 5

mesh.invalidateCaches() # need to invalidate caches after manually changing coordinates
# Save result
m…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DMBabich
Comment options

Answer selected by Fedr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants