Skip to content

Commit 8c17183

Browse files
committed
Fixed Issue #944
1 parent 32a1ea1 commit 8c17183

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/build123d/operations_part.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,8 @@ def section(
516516
else:
517517
raise ValueError("No object to section")
518518

519-
max_size = to_section.bounding_box(optimal=False).diagonal
519+
bbox = to_section.bounding_box(optimal=False)
520+
max_size = max(abs(v) for v in list(bbox.min) + list(bbox.max)) + bbox.diagonal
520521

521522
if section_by is not None:
522523
section_planes = (

tests/test_build_part.py

+6
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,12 @@ def test_custom_plane(self):
442442
s = section(section_by=Plane.XZ)
443443
self.assertAlmostEqual(s.area, 100 * pi, 5)
444444

445+
def test_moved_object(self):
446+
sec = section(Pos(-100, 100) * Sphere(10), Plane.XY)
447+
self.assertEqual(len(sec.faces()), 1)
448+
self.assertAlmostEqual(sec.face().edge().radius, 10, 5)
449+
self.assertAlmostEqual(sec.face().center(), (-100, 100, 0), 5)
450+
445451

446452
class TestSplit(unittest.TestCase):
447453
def test_split(self):

0 commit comments

Comments
 (0)