mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-06 02:30:55 -08:00
Reset topo_parent when - Face Issue #1008
Some checks failed
benchmarks / benchmarks (macos-13, 3.12) (push) Has been cancelled
benchmarks / benchmarks (macos-14, 3.12) (push) Has been cancelled
benchmarks / benchmarks (ubuntu-latest, 3.12) (push) Has been cancelled
benchmarks / benchmarks (windows-latest, 3.12) (push) Has been cancelled
Upload coverage reports to Codecov / run (push) Has been cancelled
pylint / lint (3.10) (push) Has been cancelled
Run type checker / typecheck (3.10) (push) Has been cancelled
Run type checker / typecheck (3.13) (push) Has been cancelled
Wheel building and publishing / Build wheel on ubuntu-latest (push) Has been cancelled
tests / tests (macos-13, 3.10) (push) Has been cancelled
tests / tests (macos-13, 3.13) (push) Has been cancelled
tests / tests (macos-14, 3.10) (push) Has been cancelled
tests / tests (macos-14, 3.13) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.10) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.13) (push) Has been cancelled
tests / tests (windows-latest, 3.10) (push) Has been cancelled
tests / tests (windows-latest, 3.13) (push) Has been cancelled
Wheel building and publishing / upload_pypi (push) Has been cancelled
Some checks failed
benchmarks / benchmarks (macos-13, 3.12) (push) Has been cancelled
benchmarks / benchmarks (macos-14, 3.12) (push) Has been cancelled
benchmarks / benchmarks (ubuntu-latest, 3.12) (push) Has been cancelled
benchmarks / benchmarks (windows-latest, 3.12) (push) Has been cancelled
Upload coverage reports to Codecov / run (push) Has been cancelled
pylint / lint (3.10) (push) Has been cancelled
Run type checker / typecheck (3.10) (push) Has been cancelled
Run type checker / typecheck (3.13) (push) Has been cancelled
Wheel building and publishing / Build wheel on ubuntu-latest (push) Has been cancelled
tests / tests (macos-13, 3.10) (push) Has been cancelled
tests / tests (macos-13, 3.13) (push) Has been cancelled
tests / tests (macos-14, 3.10) (push) Has been cancelled
tests / tests (macos-14, 3.13) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.10) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.13) (push) Has been cancelled
tests / tests (windows-latest, 3.10) (push) Has been cancelled
tests / tests (windows-latest, 3.13) (push) Has been cancelled
Wheel building and publishing / upload_pypi (push) Has been cancelled
This commit is contained in:
parent
02439d3a36
commit
344ba7a9ae
2 changed files with 10 additions and 0 deletions
|
|
@ -200,6 +200,9 @@ class Mixin2D(ABC, Shape):
|
|||
new_surface = copy.deepcopy(self)
|
||||
new_surface.wrapped = downcast(self.wrapped.Complemented())
|
||||
|
||||
# As the surface has been modified, the parent is no longer valid
|
||||
new_surface.topo_parent = None
|
||||
|
||||
return new_surface
|
||||
|
||||
def face(self) -> Face | None:
|
||||
|
|
|
|||
|
|
@ -169,6 +169,13 @@ class TestFace(unittest.TestCase):
|
|||
flipped_square = -square
|
||||
self.assertAlmostEqual(flipped_square.normal_at(), (0, 0, -1), 5)
|
||||
|
||||
# Ensure the topo_parent is cleared when a face is negated
|
||||
# (otherwise the original Rectangle would be the topo_parent)
|
||||
flipped = -Rectangle(34, 10).face()
|
||||
left_edge = flipped.edges().sort_by(Axis.X)[0]
|
||||
parent_face = left_edge.topo_parent
|
||||
self.assertAlmostEqual(flipped.normal_at(), parent_face.normal_at(), 5)
|
||||
|
||||
def test_offset(self):
|
||||
bbox = Face.make_rect(2, 2, Plane.XY).offset(5).bounding_box()
|
||||
self.assertAlmostEqual(bbox.min, (-1, -1, 5), 5)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue