handle_algebra.py -> update to use location_at (^) too

This commit is contained in:
jdegenstein 2024-10-22 15:31:36 -05:00 committed by GitHub
parent 8064bf7342
commit 214c0d8af0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,30 +13,23 @@ handle_center_line = Spline(
tangents=((0, 0, 1), (0, 0, -1)), tangents=((0, 0, 1), (0, 0, -1)),
tangent_scalars=(1.5, 1.5), tangent_scalars=(1.5, 1.5),
) )
# Record the center line for display and workplane creation
handle_path = handle_center_line.edges()[0]
# Create the cross sections - added to pending_faces # Create the cross sections - added to pending_faces
sections = Sketch() sections = Sketch()
for i in range(segment_count + 1): for i in range(segment_count + 1):
plane = Plane( location = handle_center_line ^ (i / segment_count)
origin=handle_path @ (i / segment_count),
z_dir=handle_path % (i / segment_count),
)
if i % segment_count == 0: if i % segment_count == 0:
circle = plane * Circle(1) circle = location * Circle(1)
else: else:
circle = plane * Rectangle(1.25, 3) circle = location * Rectangle(1.25, 3)
circle = fillet(circle.vertices(), radius=0.2) circle = fillet(circle.vertices(), radius=0.2)
sections += circle sections += circle
# Create the handle by sweeping along the path # Create the handle by sweeping along the path
handle = sweep(sections, path=handle_path, multisection=True) handle = sweep(sections, path=handle_center_line, multisection=True)
show_object(handle_path.wrapped, name="handle_path") show_object(handle_center_line, name="handle_path")
for i, circle in enumerate(sections): for i, circle in enumerate(sections):
show_object(circle.wrapped, name="section" + str(i)) show_object(circle, name="section" + str(i))
show_object(handle, name="handle", options=dict(alpha=0.6)) show_object(handle, name="handle", options=dict(alpha=0.6))
# [End] # [End]