Browse Source

refactoring fan control box

master
wes 4 months ago
parent
commit
68afbc7d6d
  1. 108
      fan_control_box.py

108
fan_control_box.py

@ -48,29 +48,72 @@ bc_hole_diameter = 4.18
# large buck converter
lbc_height = 57.8
lbc_height = 63.18
lbc_width = 57.8
lbc_hole_dist_from_top = 4.5
lbc_hole_dist_from_side = 25.8
lbc_hole_diameter = 6.83
lbc_hole_diameter = 7.0
lbc_hole_radius = lbc_hole_diameter / 2.0
wall_thickness = 3
box_height = 115 + wall_thickness
box_width = 157 + wall_thickness
# for a box, not octogon
# box_height = 115 + wall_thickness
# box_width = 157 + wall_thickness
box_radius = 87 + wall_thickness
box_thickness = 25
pole_height = box_thickness - 2
pole_dist = 10
pole_dist = 3
lower_box = Workplane()
def make_component_holder_line(
def make_component_holder_octogon(
result,
pole_height,
line_x_dist,
line_y_dist,
pole_dist,
box_radius,
x_offset=0,
y_offset=0,
):
return (
result.workplane(offset=(pole_height / 2) - wall_thickness)
.move(x_offset, y_offset)
.makePolygon(
regularPolygon(
nSides=8,
radius=box_radius
- wall_thickness
- pole_dist, # FIXME subtract wall_thickness on the input instead
thetaStart=0,
thetaEnd=360,
)
)
.vertices()
.cylinder(pole_height, 3)
.workplane(offset=(pole_height - wall_thickness + 1.5))
.move(x_offset, y_offset)
.makePolygon(
regularPolygon(
nSides=8,
radius=box_radius - wall_thickness - pole_dist,
thetaStart=0,
thetaEnd=360,
)
)
.vertices()
.threadedHole(top_screw, pole_height * 0.4, simple=screw_simple)
)
def make_component_holder_line(
result,
pole_height=0,
line_x_dist=0,
line_y_dist=0,
x_offset=0,
y_offset=0,
):
@ -107,22 +150,23 @@ def make_component_holder(
result.workplane(offset=(pole_height / 2) - wall_thickness)
.move(x_offset, y_offset)
.rect(
box_height - wall_thickness - pole_dist,
box_width - wall_thickness - pole_dist,
box_height,
box_width,
)
.vertices()
.cylinder(pole_height, 3)
.workplane(offset=(pole_height - wall_thickness + 1.5))
.move(x_offset, y_offset)
.rect(
box_height - wall_thickness - pole_dist,
box_width - wall_thickness - pole_dist,
box_height,
box_width,
)
.vertices()
.threadedHole(top_screw, pole_height * 0.4, simple=screw_simple)
)
"""
lower_box = (
lower_box.box(box_height, box_width, box_thickness)
.workplane(offset=wall_thickness)
@ -133,7 +177,35 @@ lower_box = (
combine="cut",
)
)
"""
lower_box = (
lower_box.makePolygon(
regularPolygon(
nSides=8,
radius=box_radius,
thetaStart=0,
thetaEnd=360,
)
)
.extrude(box_thickness)
.workplane(offset=-((box_thickness / 2.0) - wall_thickness))
.makePolygon(
regularPolygon(
nSides=8,
radius=box_radius - wall_thickness,
thetaStart=0,
thetaEnd=360,
)
)
.extrude(box_thickness * 2, combine="cut")
)
lower_box = make_component_holder_octogon(
lower_box, pole_height, pole_dist, box_radius, x_offset=0, y_offset=0
)
"""
lower_box = make_component_holder(
lower_box,
pole_dist,
@ -141,6 +213,7 @@ lower_box = make_component_holder(
box_width,
box_height,
)
"""
lower_box = make_component_holder(
lower_box,
@ -149,10 +222,17 @@ lower_box = make_component_holder(
breadboard_width,
breadboard_height,
x_offset=0,
y_offset=50,
y_offset=40,
)
lower_box = make_component_holder_line(lower_box, 8, 0, 15, x_offset=0, y_offset=0)
lower_box = make_component_holder_line(
lower_box,
pole_height=8,
line_x_dist=lbc_height - lbc_hole_diameter - lbc_hole_radius,
line_y_dist=0,
x_offset=-(lbc_height / 2.0),
y_offset=-(lbc_width / 2.5),
)
cq.exporters.export(lower_box, "/home/deck/model_files/fan_control_box_lower.step")

Loading…
Cancel
Save