Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions build123d/hexagon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
TRAPEZ_Z_LEN = 18
TRAPEZ_TIP = 2.2

TABS_Z_LEN = 4
ALIGN_TAB_Z_LEN = 4

FIT_TAB_RADIUS = 1.6
FIT_TAB_X = 8
FIT_TAB_Z = 2


with BuildPart() as chex:
Expand Down Expand Up @@ -54,19 +58,27 @@
mirror(about=Plane.YZ)
make_face()
extrude(amount=TRAPEZ_THICKNESS/2, both=True)
# Fit tabs.
with Locations((FIT_TAB_X, 0, FIT_TAB_Z)):
Sphere(FIT_TAB_RADIUS)
with Locations((-FIT_TAB_X, 0, FIT_TAB_Z)):
Sphere(FIT_TAB_RADIUS)
# Place Trapezoid instances.
with Locations((0, 0, BASE_Z_LEN)):
add(trapezoid_pt, rotation=(0, 0, -45))
add(trapezoid_pt, rotation=(0, 0, 45))

# Tabs (to prevent wrong insertion).
tab_z = TRAPEZ_Z_LEN - TABS_Z_LEN
# Align Tabs (to prevent wrong insertion).
tab_z = TRAPEZ_Z_LEN - ALIGN_TAB_Z_LEN
normal = Axis(origin=(0,0,0), direction=(1,1,0))
face1 = (chex.faces()
.filter_by(normal)[1]
.filter_by(normal)
.sort_by(Axis.Y)[1]
.split(Plane.XY.offset(tab_z), keep=Keep.TOP)
)
face2 = (chex.faces()
.filter_by(normal)[3]
.filter_by(normal)
.sort_by(Axis.Y)[2]
.split(Plane.XY.offset(tab_z), keep=Keep.TOP)
)
extrude(face1, until=Until.NEXT, dir=(0,1,0))
Expand Down