Skip to content

Conversation

@QubaB
Copy link

@QubaB QubaB commented Dec 13, 2025

get_cut_faces() can be used after substraction of objects to receive changed faces which correspond to cutting object

get_all_cut_faces() can be used after substraction of objects to receive all changed faces

Sample code:

def polygon_from_coords(coords):
    """
    Creates a polygon face, coordinates must be put in counter-clockwise order
    """
    wp = WorkPlane().MoveTo(*coords[0])
    for p in coords[1:]:
        wp.LineTo(*p)
    return wp.Close().Face()

# create geometry, an arbitrary shape
shape = polygon_from_coords([[0.0,1.0],[0.8,0.25],[1.0,0.25],[1.0,1.0]])
shape.faces.name = "mat"
shape3D = shape.Revolve(Axis((0, 0, 0), X), 360) # originally cyllindrically symmetrical
hole = Cylinder(Pnt(0.4,0.1,0.0),X,0.4,0.7) # hole for subtraction, slightly longer in order to cut all the way through the shape

whole = shape3D-hole    # substract objects
Draw(whole)

print(f"Number of cut faces {len(whole.get_cut_faces())}")  # get number of cut faces
for cutf in whole.get_cut_faces():
    cutf.maxh=0.05   # prescribe maxh on them
mesh = whole.GenerateMesh()
Draw(mesh)

…maxh

get_cut_faces() can be used after substraction of objects to receive changed faces which correspond to cutting object

get_all_cut_faces() can be used after substraction of objects to receive all changed faces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant