Skip to content

how to use extrude functionality in python #2745

Answered by Grantim
dhanraj-khatal asked this question in Q&A
Discussion options

You must be logged in to vote

Here is update code with extrusion along normal:

import meshlib.mrmeshpy as mrmeshpy
 
# Load mesh
mesh = mrmeshpy.loadMesh("mesh.stl")
 
# Prepare region to extrude
faces_to_extrude = mrmeshpy.FaceBitSet()
faces_to_extrude.resize(3, False)
faces_to_extrude.set(mrmeshpy.FaceId(1), True)
faces_to_extrude.set(mrmeshpy.FaceId(2), True)
 
# Create duplicated verts on region boundary
mrmeshpy.makeDegenerateBandAroundRegion(mesh, faces_to_extrude)
 
# Find vertices that will be moved
verts_for_move = mrmeshpy.getIncidentVerts(mesh.topology, faces_to_extrude)

# Find average normal
avgNorm = mrmeshpy.Vector3f()
for f in faces_to_extrude:
    avgNorm += mesh.normal( f )
avgNorm = avgNorm.normalized

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dhanraj-khatal
Comment options

@Grantim
Comment options

Answer selected by dhanraj-khatal
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