Skip to content

Commit 15d59cd

Browse files
committed
Snapshot all code for the v0.1 release
1 parent e2216a0 commit 15d59cd

2 files changed

Lines changed: 32 additions & 20 deletions

File tree

SA.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
CU = 18.415
66
CAP_TOP = 12.7
77

8+
CAP_RADIUS = 1.5
9+
10+
811
def sa_indent(angle, height, uwidth):
912
DISH_RADIUS = 55
10-
DIP = 0.738 + 0.001
13+
DIP = 0.738 + 0.1
1114

1215
rwidth = UNIT * uwidth - (UNIT-CAP_TOP)
1316

@@ -22,25 +25,21 @@ def sa_indent(angle, height, uwidth):
2225
.mirror(mirrorPlane="YZ", union=True)
2326

2427
def sa_profile_loft(angle, uwidth, height):
25-
LOFT = 2
28+
LOFT = 1
2629

2730
rwidth = UNIT * uwidth - (UNIT - CU)
2831
rwidth_cap = UNIT * uwidth - (UNIT - CAP_TOP)
2932

30-
cronk = cq.Workplane("XY").rect(rwidth, CU)
31-
cronk = cronk.workplane(offset=LOFT).transformed(rotate=(0, 0, 0)).rect(rwidth - 0.1, CU * 0.99)
32-
cronk = cronk.add(cq.Workplane("XY")).transformed(offset=(0, 0, height-LOFT), rotate=(angle, 0, 0)).rect(rwidth_cap, CAP_TOP)
33-
cronk = cronk.loft()
34-
3533
dish = sa_indent(angle, height, uwidth)
36-
cronk = cronk.cut(dish)
3734

38-
cronk = cronk.faces("<Z").shell(-1.5, kind = 'arc')
39-
cronk = cronk.edges("not <Z").fillet(1)
35+
bottom = cq.Workplane("XY").rect(rwidth - 1, CU - 1).offset2D(0.5)
36+
support = cq.Workplane("XY").transformed(offset=(0, 0, LOFT)).rect(rwidth - 1.1, CU - 1.1).offset2D(0.5)
37+
top = cq.Workplane("XY").transformed(offset=(0, 0, height), rotate=(angle, 0, 0)).rect(rwidth_cap - 2*CAP_RADIUS, CAP_TOP - 2*CAP_RADIUS).offset2D(1.5).consolidateWires()
4038

41-
#cronk = cq.Workplane("XY").box(UNIT, UNIT, UNIT, centered = [True, True, False]).cut(dish).edges().fillet(2)
39+
keycap = cq.Workplane("XY").add(bottom).add(support).add(top).toPending().loft().cut(dish)
40+
keycap = keycap.edges(cq.selectors.BoxSelector((-rwidth/2, -CU/2, height-2), (rwidth/2, CU/2, height+5))).fillet(0.25)
4241

43-
return cronk
42+
return keycap
4443

4544

4645
def sa_profile(row, uwidth):
@@ -77,14 +76,15 @@ def draw_keys(keys):
7776
coff = 0
7877

7978
for key in row:
80-
kobj = sa_profile(key[0], key[1]).translate([(coff + key[1]/2) * UNIT, -roff * UNIT, 0])#.fillet(0.0001)
79+
kobj = sa_profile(key[0], key[1]).translate([(coff + key[1]/2) * UNIT, -roff * UNIT, 0])
80+
fname = "build/SA/%1dR%3dU.step" % (key[0], key[1]*100)
81+
cq.exporters.export(kobj, fname)
8182
show_object(kobj, "Key (%.2f x %d)" % (coff, roff))
8283
coff += key[1]
8384

8485
roff += 1
8586

8687

8788
draw_keys(keys)
88-
#draw_keys([[[5, 6.5]]])
89+
#draw_keys([[[3, 1.25]]])
8990

90-
#show_object(sa_profile(3, 1.25))

trash.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,20 @@
1010
LOFT = 1
1111
LA = 1
1212

13-
cronk = cq.Workplane("XY").rect(CU, CU)
14-
cronk = cronk.workplane(offset = LOFT).transformed(rotate = (LA, 0, 0)).rect(CU * 0.99, CU * 0.99)
15-
cronk = cronk.workplane(offset =BOTTOM - LOFT).transformed(rotate = (13 - LA, 0, 0)).rect(CAP_TOP, CAP_TOP)
16-
cronk = cronk.loft().faces("<Z").shell(-1)#.faces("not <Z").fillet(0.5)
17-
show_object(cronk)
13+
#cronk = cq.Workplane("XY").rect(CU, CU)
14+
#cronk = cronk.workplane(offset = LOFT).transformed(rotate = (LA, 0, 0)).rect(CU * 0.99, CU * 0.99)
15+
#cronk = cronk.workplane(offset =BOTTOM - LOFT).transformed(rotate = (13 - LA, 0, 0)).rect(CAP_TOP, CAP_TOP)
16+
#cronk = cronk.loft().faces("<Z").shell(-1)#.faces("not <Z").fillet(0.5)
17+
#show_object(cronk)
18+
19+
20+
bottom = cq.Workplane("XY").rect(CU-1, CU-1).offset2D(0.5)
21+
support = cq.Workplane("XY").transformed(offset=(0, 0, 1)).rect(CU-1.1, CU-1.1).offset2D(0.5)
22+
top = cq.Workplane("XY").transformed(offset=(0, 0, 10)).rect(CAP_TOP-3, CAP_TOP-3).offset2D(1.5).consolidateWires()
23+
24+
twee = cq.Workplane("XY").add(bottom).add(support).add(top).toPending().loft().faces(">Z").fillet(0.5)
25+
26+
show_object(bottom)
27+
show_object(support)
28+
show_object(top)
29+
show_object(twee)

0 commit comments

Comments
 (0)