Bore hole

This commit is contained in:
Christian Colglazier 2022-05-26 19:06:38 -04:00
parent a17856aef9
commit 967755f7b1

View File

@ -120,6 +120,36 @@ def createOutline(ex_amount):
base = base.edges('|Z').edges('<<Y[-2]').fillet(5)
return base
# Based on https://github.com/gumyr/cq_warehouse/issues/42 from jdegs
def boreHole(caph_diam, caph_dep, step_dep, thd_diam, thd_dep):
s_p0 = ( #cap head circle
cq.Sketch()
.circle(caph_diam/2)
)
s_p1 = ( #rect slot with circular cut-ends
cq.Sketch()
.circle(caph_diam/2)
.rect(caph_diam,thd_diam,mode='i')
)
s_p2 = ( #thread circle
cq.Sketch()
.circle(thd_diam/2)
)
f_fancyh = ( #assemble components
cq.Workplane()
.placeSketch(s_p0)
.extrude(caph_dep).faces(">Z").workplane()
.placeSketch(s_p1)
.extrude(step_dep).faces(">Z").workplane()
.placeSketch(s_p2)
.extrude(thd_dep)
)
return f_fancyh.rotate((1,0,0),(0,0,0),180)
lid = createOutline(-lid_thicknesss).translate((0,0,part_thinkness))
base = createOutline(part_thinkness)
@ -208,12 +238,12 @@ lid = lid.faces('>Z[0]').workplane().circle(2).cutThruAll()
lid = lid.faces('<Z[0]').workplane().circle(m3_head_diameter/2).cutBlind(-m3_head_depth)
# Lid Holes
lid = lid.faces('<Z[0]').workplane().center(-stepper_motor_size+wall_width,-stepper_motor_size+offset/2-loop_width)\
.circle(m3_passthrough/2).cutThruAll()
drill = lid.faces('<Z[0]').workplane().circle(m3_tap/2)\
c = lid.faces('<Z[0]').workplane().center(-stepper_motor_size+wall_width,-stepper_motor_size+offset/2-loop_width).val()
drill = lid.faces('<Z[0]').workplane().center(-stepper_motor_size+wall_width,-stepper_motor_size+offset/2-loop_width).circle(m3_tap/2)\
.extrude(-part_thinkness+wall_width, combine=False)
cut = boreHole(m3_head_diameter, m3_head_depth, 0.4, m3_passthrough, m3_passthrough).translate(c)
base = base.cut(drill)
lid = lid.faces('<Z[0]').workplane().circle(m3_head_diameter/2).cutBlind(-m3_head_depth)
lid = lid.cut(cut)
# Gears
l_gear = cq.Workplane('XY').gear(SpurGear(module=mod,