Removing make_face changes keeping BoundBox.extent
Some checks are pending
benchmarks / benchmarks (macos-14, 3.12) (push) Waiting to run
benchmarks / benchmarks (macos-15-intel, 3.12) (push) Waiting to run
benchmarks / benchmarks (ubuntu-latest, 3.12) (push) Waiting to run
benchmarks / benchmarks (windows-latest, 3.12) (push) Waiting to run
Upload coverage reports to Codecov / run (push) Waiting to run
pylint / lint (3.10) (push) Waiting to run
Run type checker / typecheck (3.10) (push) Waiting to run
Run type checker / typecheck (3.13) (push) Waiting to run
Wheel building and publishing / Build wheel on ubuntu-latest (push) Waiting to run
Wheel building and publishing / upload_pypi (push) Blocked by required conditions
tests / tests (macos-14, 3.10) (push) Waiting to run
tests / tests (macos-14, 3.13) (push) Waiting to run
tests / tests (macos-15-intel, 3.10) (push) Waiting to run
tests / tests (macos-15-intel, 3.13) (push) Waiting to run
tests / tests (ubuntu-latest, 3.10) (push) Waiting to run
tests / tests (ubuntu-latest, 3.13) (push) Waiting to run
tests / tests (windows-latest, 3.10) (push) Waiting to run
tests / tests (windows-latest, 3.13) (push) Waiting to run

This commit is contained in:
gumyr 2025-11-20 13:31:25 -05:00
parent 02a8c07e0a
commit 26caed754c
2 changed files with 9 additions and 29 deletions

View file

@ -43,8 +43,6 @@ from build123d.topology import (
Wire,
Sketch,
topo_explore_connected_edges,
topo_explore_common_vertex,
edges_to_wires,
)
from build123d.geometry import Plane, Vector, TOLERANCE
from build123d.build_common import flatten_sequence, validate_inputs
@ -201,33 +199,26 @@ def make_face(
) -> Sketch:
"""Sketch Operation: make_face
Create a face from the given edges.
Create a face from the given perimeter edges.
Args:
edges (Edge): sequence of edges. Defaults to all sketch pending edges.
edges (Edge): sequence of perimeter edges. Defaults to all
sketch pending edges.
mode (Mode, optional): combination mode. Defaults to Mode.ADD.
"""
context: BuildSketch | None = BuildSketch._get_context("make_face")
if edges is not None:
raw_edges = flatten_sequence(edges)
outer_edges = flatten_sequence(edges)
elif context is not None:
raw_edges = context.pending_edges
outer_edges = context.pending_edges
else:
raise ValueError("No objects to create a face")
if not raw_edges:
raise ValueError("No objects to create a face")
validate_inputs(context, "make_face", raw_edges)
if not outer_edges:
raise ValueError("No objects to create a hull")
validate_inputs(context, "make_face", outer_edges)
wires = list(
edges_to_wires(raw_edges).sort_by(
lambda w: w.bounding_box().measure, reverse=True
)
)
if len(wires) > 1:
pending_face = Face(wires[0], wires[1:])
else:
pending_face = Face(wires[0])
pending_face = Face(Wire.combine(outer_edges)[0])
if pending_face.normal_at().Z < 0: # flip up-side-down faces
pending_face = -pending_face

View file

@ -168,17 +168,6 @@ class TestUpSideDown(unittest.TestCase):
sketch = make_face(wire.edges())
self.assertTrue(sketch.faces()[0].normal_at().Z > 0)
def test_make_face_with_holes(self):
with BuildSketch() as skt:
with BuildLine() as perimeter:
CenterArc((0, 0), 3, 0, 360)
with BuildLine() as hole1:
Polyline((-1, 1), (1, 1), (1, 2), (-1, 2), (-1, 1))
with BuildLine() as hole2:
Airfoil("4020")
make_face()
self.assertEqual(len(skt.face().inner_wires()), 2)
class TestBuildSketchExceptions(unittest.TestCase):
"""Test exception handling"""