Skip to content

Commit

Permalink
pcb, case
Browse files Browse the repository at this point in the history
  • Loading branch information
crides committed Oct 30, 2023
1 parent 79343d9 commit 8641f85
Show file tree
Hide file tree
Showing 4 changed files with 4,331 additions and 4,562 deletions.
15 changes: 8 additions & 7 deletions bear.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import cadquery as cq
import math

ball_r = 34 / 2
ball_r = 25 / 2
gap_r = 1
wall_t = 3
wall_t = 2.5
bear_r = 4.3 / 2
lens_dist = 2.4
pcb_lens_dist = 2
Expand All @@ -16,7 +16,7 @@ def polar(r, theta, phi):
return cq.Vector(xy * math.cos(theta), xy * math.sin(theta), math.cos(phi) * r)

# pts = [polar(59/2, math.radians(t + p), math.radians(p)) for t in [0, 120, 240] for p in [60, 120]]
phis = list(map(math.radians, [75, 120]))
phis = list(map(math.radians, [75, 135]))
pts = [polar(ball_out_r, math.radians(t * 90 + (1-p) * 45), phis[p]) for t in range(4) for p in range(2)]
# print(pts)
bears = (cq.Workplane()
Expand All @@ -40,7 +40,7 @@ def polar(r, theta, phi):
.rect(9, 17).extrude(-pcb_lens_dist, combine="s") # TODO actual size and location
.slot2D(9, 6, 90).cutThruAll() # TODO actual size and location
.faces("<Z[2]")
.workplane(offset=-ball_r * 0.35)
.workplane(offset=-ball_r * 0.65)
.split(keepTop=True, keepBottom=True)
)
holder_top = holder.solids(">Z")
Expand All @@ -56,11 +56,12 @@ def polar(r, theta, phi):
top_wires = sorted(holder_top.faces("<Z").wires().vals(), key=lambda e: e.BoundingBox().xlen)
adapter = cq.Workplane().add(cq.Solid.makeLoft([top_wires[1], bot_wires[1]])).cut(cq.Solid.makeLoft([top_wires[0], bot_wires[0]]))
holder_top += adapter + top_shroud
holder_top = holder_top.translate((0, 0, bottom)) + cq.Workplane().rarray(41, 28.8, 2, 2).cylinder(7, 3, centered=(True, True, False)) - cq.Workplane().rarray(41, 28.8, 2, 2).cylinder(5, 3.5 / 2, centered=(True, True, False))
bot_holes = [(-15, 0), (15, 0), (0, 15), (0, -15)]
holder_bot = holder_bot.translate((0, 0, bottom)) + cq.Workplane().pushPoints(bot_holes).cylinder(7, 3, centered=(True, True, False)) - cq.Workplane().pushPoints(bot_holes).cylinder(5, 3.5 / 2, centered=(True, True, False))
print(holder_top.val().BoundingBox().xlen)
holder_top = holder_top.translate((0, 0, bottom)) + cq.Workplane().rarray(31.2, 23, 2, 2).cylinder(7, 3, centered=(True, True, False)) - cq.Workplane().rarray(31.2, 23, 2, 2).cylinder(5, 3.5 / 2, centered=(True, True, False))
holder_bot = holder_bot.translate((0, 0, bottom)) - cq.Workplane().polarArray(12, 15, 360, 3).cylinder(4, 3.5 / 2, centered=(True, True, False)) - cq.Workplane().box(9.6 * 2, 9 * 2, 2, centered=(True, True, False))

ball = cq.Workplane().sphere(ball_r).translate((0, 0, bottom))
print(bottom + ball_r * 2)

whole = (cq.Assembly()
.add(holder_top, name="holder_top")
Expand Down
4 changes: 2 additions & 2 deletions case.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
sks = cq.Workplane().placeSketch(sk_sk().reset().wires().offset(sk_cl + sk_w)).extrude(sk_top_h) - cq.Workplane().placeSketch(sk_sk().reset().wires().offset(sk_cl)).extrude(sk_top_h)
l_base = lalf_b.add([l_mid_col, l_side_cols, l_pink_clus, l_ind_out]).cutThruAll() + lalf_edge
lalf = l_base + sks.solids("<X") - comp_hole.intersect(lalf_b)
ralf = mirror(l_base) + sks.solids(">X") - comp_hole.intersect(ralf_b) - cq.Workplane().placeSketch(board.layer(pcbnew.User_4)).extrude(-10)
ralf = mirror(l_base) + sks.solids(">X") - comp_hole.intersect(ralf_b) - cq.Workplane().placeSketch(board.layer(pcbnew.User_4)).extrude(-10) - cq.Workplane().placeSketch(board.layer(pcbnew.User_5)).extrude(2)

lcon, rcon = board.pos("J3"), board.pos("J12")

Expand Down Expand Up @@ -106,7 +106,7 @@
ralf -= cq.Workplane().placeSketch(board.layer(pcbnew.User_3)).extrude(10)

lalf_bot = lalf_bot.transformed(offset=(l_mid_k[0], lcon[1], -bot_h)).circle(8).circle(9 / 2).extrude(-8).translate((0, 0, -pcb_thik))
ralf_bot = ralf_bot.transformed(offset=(r_mid_k[0], rcon[1], -bot_h)).circle(8).circle(9 / 2).extrude(-8).translate((0, 0, -pcb_thik))
ralf_bot = ralf_bot.transformed(offset=(r_mid_k[0], rcon[1], -bot_h)).circle(8).circle(9 / 2).extrude(-8).translate((0, 0, -pcb_thik)) - cq.Workplane().placeSketch(board.layer(pcbnew.User_4)).extrude(-10)

cq.exporters.export(lalf, "pcb/fissure/left-case.step")
cq.exporters.export(lalf_bot, "pcb/fissure/left-case-bot.step")
Expand Down
Loading

0 comments on commit 8641f85

Please sign in to comment.