From 8064bf73425d417b34f81557b7d19f1abbc2de0a Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Tue, 22 Oct 2024 15:27:38 -0500 Subject: [PATCH] handle.py -> use `location_at` (`^`) instead of manual Plane construction with position/tangent --- examples/handle.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/examples/handle.py b/examples/handle.py index c46833b..1c37d49 100644 --- a/examples/handle.py +++ b/examples/handle.py @@ -42,17 +42,10 @@ with BuildPart() as handle: tangents=((0, 0, 1), (0, 0, -1)), tangent_scalars=(1.5, 1.5), ) - # Record the center line for display and workplane creation - handle_path: Wire = handle_center_line.wires()[0] # Create the cross sections - added to pending_faces for i in range(segment_count + 1): - with BuildSketch( - Plane( - origin=handle_path @ (i / segment_count), - z_dir=handle_path % (i / segment_count), - ) - ) as section: + with BuildSketch(handle_center_line.line ^ (i / segment_count)) as section: if i % segment_count == 0: Circle(1) else: @@ -66,8 +59,8 @@ with BuildPart() as handle: assert abs(handle.part.volume - 94.77361455046953) < 1e-3 -show_object(handle_path.wrapped, name="handle_path") +show_object(handle_center_line.line, name="handle_center_line") for i, section in enumerate(sections): - show_object(section.wrapped, name="section" + str(i)) -show_object(handle.part.wrapped, name="handle", options=dict(alpha=0.6)) + show_object(section, name="section" + str(i)) +show_object(handle.part, name="handle", options=dict(alpha=0.6)) # [End]