Skip to content

Generate parameterized uniformly distributed holes on the STL surface #2472

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

You must be logged in to vote

This script may work for you:
Input Mesh

Fixed and thicken mesh

Cylinders

Result

from meshlib import mrmeshpy as mm

path = "working_directory"

# load mesh
mesh = mm.loadMesh(path + "pig.stl")
box = mesh.computeBoundingBox()
thickness = box.diagonal()*1e-2

# heal mesh (your mesh has self-intersectoins and not connected parts)
goParams = mm.GeneralOffsetParameters()
goParams.signDetectionMode = mm.SignDetectionMode.HoleWindingRule
mesh = mm.generalOffsetMesh(mesh,0,goParams)

# sample point
points = mm.meshToPointCloud(mesh)
sampleDistance = thickness*2
samples = mm.pointUniformSampling(points,sampleDistance)

# thicken mesh
mesh = mm.thickenMesh(mesh,-thickness)
ds = mm.DecimateSett…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@WHUT666
Comment options

@WHUT666
Comment options

@Grantim
Comment options

Answer selected by WHUT666
@WHUT666
Comment options

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