Browse Source

working function for generating component holders

master
wes 4 months ago
parent
commit
a056af8a55
  1. 46
      fan_control_box.py

46
fan_control_box.py

@ -16,9 +16,6 @@ Workplane.addSvgPath = addSvgPath
screw_simple = False # Controls whether to not actually make the screw threads, saves time running it for testing screw_simple = False # Controls whether to not actually make the screw threads, saves time running it for testing
pole_height = 24.5
pole_dist = 10
screw_length = 10 # FIXME need different ones for different holes screw_length = 10 # FIXME need different ones for different holes
top_screw = ButtonHeadScrew( top_screw = ButtonHeadScrew(
size="M3-0.5", size="M3-0.5",
@ -63,16 +60,46 @@ box_height = 115 + wall_thickness
box_width = 157 + wall_thickness box_width = 157 + wall_thickness
box_thickness = 25 box_thickness = 25
pole_height = box_thickness - 2
pole_dist = 10
lower_box = Workplane() lower_box = Workplane()
def make_component_holder_line(
result,
pole_height,
line_x_dist,
line_y_dist,
x_offset=0,
y_offset=0,
):
return (
result.workplane(offset=(pole_height / 2) - wall_thickness)
.move(x_offset, y_offset)
.line(
line_x_dist,
line_y_dist,
)
.vertices()
.cylinder(pole_height, 3)
.workplane(offset=(pole_height - wall_thickness + 1.5))
.move(x_offset, y_offset)
.line(
line_x_dist,
line_y_dist,
)
.vertices()
.threadedHole(top_screw, pole_height * 0.4, simple=screw_simple)
)
def make_component_holder( def make_component_holder(
result, result,
pole_dist, pole_dist,
pole_height, pole_height,
box_width, box_width,
box_height, box_height,
wall_thickness,
x_offset=0, x_offset=0,
y_offset=0, y_offset=0,
): ):
@ -113,13 +140,20 @@ lower_box = make_component_holder(
pole_height, pole_height,
box_width, box_width,
box_height, box_height,
wall_thickness,
) )
lower_box = make_component_holder( lower_box = make_component_holder(
lower_box, pole_dist, 10, 50, 30, wall_thickness, x_offset=10, y_offset=15 lower_box,
pole_dist,
10,
breadboard_width,
breadboard_height,
x_offset=0,
y_offset=50,
) )
lower_box = make_component_holder_line(lower_box, 8, 0, 15, x_offset=0, y_offset=0)
cq.exporters.export(lower_box, "/home/deck/model_files/fan_control_box_lower.step") cq.exporters.export(lower_box, "/home/deck/model_files/fan_control_box_lower.step")
try: try:

Loading…
Cancel
Save