Export stl files for follow focus

This commit is contained in:
Christian Colglazier 2022-05-22 21:57:46 -04:00
parent da8b5dee5c
commit 26f82baa33

View File

@ -18,10 +18,13 @@ fastener_height= 3.5
fastener_length= 20
fastener_h_spacing= .2
fastener_gap= .2
hex_diameter= 8.5
hex_depth= 4
# NEMA 17 stepper motor
stepper_motor_size= 42.0
stepper_hole_width= 31.0
stepper_mount_dia= 22.5
# Case
part_thinkness= 20
@ -74,7 +77,8 @@ support_x = (support_y-b)/slope
lg_x = support_x-stepper_center[0]
lg_y = support_y-stepper_center[1]
lg_radius = (math.sqrt(lg_x**2 + lg_y**2)-sg_teeth*mod/2)
sg_radius = sg_teeth*mod/2
lg_radius = (math.sqrt(lg_x**2 + lg_y**2)-sg_radius)
def findRodInter(n_x, n_y):
p = Point(center_x, center_y)
@ -138,7 +142,7 @@ base = base.faces('<<Z[0]').workplane().vLine(offset+loop_width, forConstruction
.close().cutBlind(-lid_thicknesss)
base = base.faces('>>Z[0]').workplane().center(stepper_center[0], -stepper_center[1])\
.circle(22.5/2)\
.circle(stepper_mount_dia/2)\
.pushPoints([(stepper_hole_radius*math.cos(math.radians(45+slant_degree)),\
stepper_hole_radius*math.sin(math.radians(45+slant_degree))),\
(stepper_hole_radius*math.cos(math.radians(135+slant_degree)),\
@ -157,7 +161,7 @@ lid = lid.faces('>Z[0]').shell(.000001-wall_width)
lid = lid.add(copy)
lid = lid.faces('>Z[1]').workplane().center(stepper_center[0], -stepper_center[1])\
.circle(5).extrude(lid_thicknesss-wall_width)
.circle(sg_radius+mod).extrude(lid_thicknesss-wall_width)
lid = lid.faces('>Z[0]').workplane().circle(5/2).cutThruAll()
base = base.faces('<Z[1]').workplane().center(lg_x, lg_y).circle(lg_radius+2*mod).cutBlind(-gear_thinkness-gear_gap)
@ -182,8 +186,8 @@ fastener = fastener.faces('<<Y[-1]').workplane().center(-fastener_length,0)\
.close().extrude(-fastener_height)
fastener = fastener.faces('<<Y[-1]').workplane().circle(fastener_width/6).extrude(-fastener_height)
fastener = fastener.faces('<<Y[-1]').center(fastener_length,0)\
.sketch().regularPolygon(8.5/2,6,tag='outer')\
.finalize().cutBlind(-4)
.sketch().regularPolygon(hex_diameter/2,6)\
.finalize().cutBlind(-hex_depth)
fastener = fastener.faces('<<Y[-6]').workplane().circle(5/2).cutThruAll()
# Lid large gear mount point
@ -219,7 +223,7 @@ s_gear = cq.Workplane('XY').gear(SpurGear(module=mod,
tab_distance = 2
shaft_diameter = 5
copy = s_gear.faces('<Z[0]').workplane().vLine(tab_distance, forConstruction=True)\
.hLine(10).vLine(-10).hLine(-20).vLine(10)\
.hLine(lg_radius).vLine(-lg_radius).hLine(-lg_radius*2).vLine(lg_radius)\
.close().cutThruAll()
s_gear = s_gear.faces('<Z[0]').sketch().circle(shaft_diameter/2).finalize().cutThruAll()
s_gear = s_gear.add(copy)
@ -232,3 +236,9 @@ show_object(fastener, name='Follow Focus Fastener')
show_object(l_gear, name='Follow Focus Large Gear')
show_object(s_gear, name='Follow Focus Small Gear')
# Export STL
cq.exporters.export(base, 'follow-focus-base.stl')
cq.exporters.export(lid, 'follow-focus-lid.stl')
cq.exporters.export(fastener, 'follow-focus-fastener.stl')
cq.exporters.export(l_gear, 'follow-focus-large_gear.stl')
cq.exporters.export(s_gear, 'follow-focus-small_gear.stl')