Removed hardcoded support center

This commit is contained in:
Christian Colglazier 2022-05-22 16:32:55 -04:00
parent d97c0692b1
commit eb0379dff2

View File

@ -30,7 +30,7 @@ loop_width=wall_width
loop_angle=40
rod_diameter=15.2
offset=9
tab_height=7
tab_height=6
tab_width=25
# Gears
@ -53,6 +53,23 @@ end_y=-4.3
outer_ring_diameter=rod_diameter+2*loop_width
center_x=end_x-math.cos(math.radians(loop_angle))*outer_ring_diameter/2
center_y=end_y-math.sin(math.radians(loop_angle))*outer_ring_diameter/2
# Stepper motor mount points
stepper_hole_radius=stepper_hole_width/2*math.sqrt(2)
stepper_center = cq.Workplane('XY').lineTo(0, offset)\
.polarLine(stepper_motor_size/2, 90-slant_degree)\
.polarLine(stepper_motor_size/2, -slant_degree)\
.val().endPoint().toTuple()
e = cq.Workplane('XY').lineTo(0,offset).polarLine(stepper_motor_size, 90-slant_degree).hLine(width)
end = e.val().endPoint().toTuple()
e = e.polarLine(support_radius,180-slant_degree).val().endPoint().toTuple()
slope = math.tan(math.radians(90-slant_degree))
b = e[1] - slope*e[0]
support_y = end[1]-support_radius
support_x = (support_y-b)/slope
lg_x=support_x-stepper_center[0]
lg_y=support_y-stepper_center[1]
def findRodInter(n_x, n_y):
p = Point(center_x, center_y)
@ -115,12 +132,6 @@ base = base.faces('<<Z[0]').workplane().vLine(offset+loop_width, forConstruction
.hLine(-2*stepper_motor_size)\
.close().cutBlind(-lid_thicknesss)
# Stepper motor mount points
stepper_hole_radius=stepper_hole_width/2*math.sqrt(2)
stepper_center = cq.Workplane('XY').lineTo(0, offset)\
.polarLine(stepper_motor_size/2, 90-slant_degree)\
.polarLine(stepper_motor_size/2, -slant_degree)\
.val().endPoint().toTuple()
base = base.faces('>>Z[0]').workplane().center(stepper_center[0], -stepper_center[1])\
.circle(22.5/2)\
.pushPoints([(stepper_hole_radius*math.cos(math.radians(45+slant_degree)),\
@ -144,7 +155,7 @@ lid = lid.faces('>Z[1]').workplane().center(stepper_center[0], -stepper_center[1
.circle(5).extrude(lid_thicknesss-wall_width)
lid = lid.faces('>Z[0]').workplane().circle(5/2).cutThruAll()
base = base.faces('<Z[1]').workplane().center(21,20.15).circle(26.5).cutBlind(-gear_thinkness-gear_gap)
base = base.faces('<Z[1]').workplane().center(lg_x, lg_y).circle(26.5).cutBlind(-gear_thinkness-gear_gap)
base = base.faces('<Z[2]').workplane().hLine(support_radius, forConstruction=True)\
.threePointArc((-support_radius,-support_radius/2),(0,support_radius))\
.polarLine(support_radius, -slant_degree)\
@ -170,7 +181,7 @@ fastener = fastener.faces('<<Y[-1]').center(fastener_length,0)\
fastener = fastener.faces('<<Y[-6]').workplane().circle(5/2).cutThruAll()
# Lid large gear mount point
lid = lid.faces('>Z[0]').workplane().center(21,-20.15)\
lid = lid.faces('>Z[0]').workplane().center(lg_x,-lg_y)\
.hLine(support_radius, forConstruction=True)\
.threePointArc((-support_radius, support_radius/2),(0,-support_radius))\
.polarLine(support_radius, slant_degree)\