Adding arc center & radius to full_round return value

This commit is contained in:
gumyr 2024-02-15 14:00:56 -05:00
parent e252384e1e
commit b3019fc0a6
2 changed files with 12 additions and 4 deletions

View file

@ -54,7 +54,7 @@ def full_round(
invert: bool = False,
voronoi_point_count: int = 100,
mode: Mode = Mode.REPLACE,
):
) -> tuple[Sketch, Vector, float]:
"""Sketch Operation: full_round
Given an edge from a Face/Sketch, modify the face by replacing the given edge with the
@ -72,6 +72,10 @@ def full_round(
Raises:
ValueError: Invalid geometry
Returns:
(Sketch, Vector, float): A tuple where the first value is the modified shape, the second the
geometric center of the arc, and the third the radius of the arc
"""
context: BuildSketch = BuildSketch._get_context("full_round")
@ -187,7 +191,7 @@ def full_round(
context.pending_edges = ShapeList()
# return Sketch(Compound([pending_face]).wrapped)
return Sketch([pending_face])
return Sketch([pending_face]), new_arc.arc_center, new_arc.radius
def make_face(

View file

@ -485,9 +485,13 @@ class TestBuildSketchObjects(unittest.TestCase):
with self.assertRaises(ValueError):
full_round(face.edges()[0])
positive = full_round(trap.edges().sort_by(SortBy.LENGTH)[0])
negative = full_round(trap.edges().sort_by(SortBy.LENGTH)[0], invert=True)
positive, c1, r1 = full_round(trap.edges().sort_by(SortBy.LENGTH)[0])
negative, c2, r2 = full_round(
trap.edges().sort_by(SortBy.LENGTH)[0], invert=True
)
self.assertLess(negative.area, positive.area)
self.assertAlmostEqual(r1, r2, 2)
self.assertTupleAlmostEquals(tuple(c1), tuple(c2), 2)
if __name__ == "__main__":