Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New conductive hex #27

Merged
merged 6 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
68 changes: 68 additions & 0 deletions build123d/hexagon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from build123d import (
BuildPart, BuildSketch, BuildLine, Polyline, Circle, Plane, Locations, Mode, Location,
mirror, make_face, extrude, add)

import math

try:
from ocp_vscode import show_object
except ModuleNotFoundError:
pass


# top hex
HEX_TOP_HEIGHT = 1.9
HEX_DEPTH = 40
HEX_PTS = ((0, 0), ## only half => mirror
przymi marked this conversation as resolved.
Show resolved Hide resolved
(18, 10),
(18, 30),
(0, HEX_DEPTH))

HEX_HOLE_LOCATIONS=(
(0, 8),
(0, 32),
(12, 20),
(-12, 20))

hex_hole_radius=5


# trapezoid
TRAPEZ_WIDTH = 2.758 ## tight: 2.8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round values or use original values derived with sin(45)

TRAPEZ_PTS = ((0, 0),
przymi marked this conversation as resolved.
Show resolved Hide resolved
(math.sqrt(200), 0),
przymi marked this conversation as resolved.
Show resolved Hide resolved
(3, 18 - HEX_TOP_HEIGHT),
(0, 18 - HEX_TOP_HEIGHT))


with BuildPart() as hex:
przymi marked this conversation as resolved.
Show resolved Hide resolved
with BuildSketch():
with BuildLine() as top_outline:
line = Polyline(HEX_PTS)
mirror(top_outline.line, about=Plane.YZ)

make_face()

with Locations(HEX_HOLE_LOCATIONS):
Circle(hex_hole_radius, mode=Mode.SUBTRACT)

extrude(amount=HEX_TOP_HEIGHT)

with BuildPart(mode=Mode.PRIVATE) as bottom_pt:
plane = Plane.XZ.offset(-TRAPEZ_WIDTH / 2)
with BuildSketch(plane):
with BuildLine() as bottom_outline:
line = Polyline(TRAPEZ_PTS)
mirror(bottom_outline.line, about=Plane.YZ)

make_face()
extrude(amount=TRAPEZ_WIDTH)

with Locations(Location((0, HEX_DEPTH / 2, HEX_TOP_HEIGHT))):
add(bottom_pt, rotation=(0, 0, -45))
add(bottom_pt, rotation=(0, 0, 45))


if __name__ in ['__main__', 'temp']:
show_object(hex)
print(f"Volume: {hex.part.volume}")
4 changes: 4 additions & 0 deletions scripts/export_b123d.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from wheel import wheel, core, holder
from trigger_r1 import trigger_r1
from cover import cover
from hexagon import hex

STL_DIR = 'stl/'
STEP_DIR = 'step/'
Expand All @@ -25,3 +26,6 @@ def export(obj, filename):

# Battery Cover.
export(cover.part, 'secondary_015mm_cover')

# Conductive Hex.
export(cover.part, 'conductive_015mm_hexagon')
przymi marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion scripts/export_blender.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ def export(self):
Entry('Dpad', 'secondary_007mm_dpad_4x', split=True),
Entry('Home', 'secondary_007mm_home', rotate=True),
Entry('Thumbstick', 'secondary_007mm_thumbstick', tolerance=True),
Entry('Hexagon', 'conductive_015mm_hexagon', '-Z', tolerance=True),
Entry('Anchor', 'any_015mm_anchors_2x', '-Z', split=True),
Entry('Soldering helper', 'any_020mm_solderstand', '-Z', merge=True),
]
Expand Down