Quellcode durchsuchen

finalize zellhalter

Silas Gruen vor 1 Jahr
Ursprung
Commit
046ed33630
1 geänderte Dateien mit 72 neuen und 12 gelöschten Zeilen
  1. 72 12
      segment_gehauese/zellhalter_v2.py

+ 72 - 12
segment_gehauese/zellhalter_v2.py

@@ -15,14 +15,19 @@ space_all = 140
 space_single = space_all / (cells_per_row - 1)
 space_rows = 33.7
 
-strip_width = 10.2
+dist_segments = 57.5
 
-# board_connector_length = 
+strip_width = 10.2
 
-print_height = 10
-wall_thick = 1.5
+print_height = 15
+wall_thick = 1.7
 eps = 0.1
 
+hole_diam = 2.4
+hole_depth = 10
+board_connector_length = dist_to_ground + wall_thick + eps
+lip_width = 1.5
+lip_thick = 1.5
 
 ############
 
@@ -30,6 +35,15 @@ cell_locs = [(x * space_single, y * space_rows) for x in range(0, cells_per_row)
 strip_locs = [(-cell_diam/4, y * space_rows) for y in range(0, rows)]
 connector_locs = [(x * space_single * 2, (y + 0.5) * space_rows) for x in range(0, int(cells_per_row/2)) for y in range(0, rows-1)]
 
+cell_edge = cell_diam/2 - 1.5
+board_con_locs = [
+   (-.5 * space_single, -cell_edge),
+   (-.5 * space_single, space_rows + cell_edge),
+   (1.5 * space_single, space_rows - cell_edge),
+   (5.5 * space_single, cell_edge),
+   (5.5 * space_single, space_rows - cell_edge)
+]
+
 cell_base = (
    cq.Workplane()
    .pushPoints(cell_locs)
@@ -49,7 +63,7 @@ cell_cutout = (
    .eachpoint(
       lambda loc: (
          cq.Workplane()
-         .circle(cell_diam/2 + eps )
+         .circle(cell_diam/2 + eps)
          .extrude(print_height-wall_thick)
          .val()
          .located(loc)
@@ -62,9 +76,9 @@ strips_cut = (
    .pushPoints(strip_locs)
    .eachpoint(
       lambda loc: (
-         cq.Workplane()
+         cq.Workplane().workplane(offset=print_height-wall_thick)
          .rect(space_all + cell_diam/2, strip_width, centered=(False, True))
-         .extrude(print_height)
+         .extrude(wall_thick)
          .val()
          .located(loc)
       )
@@ -76,8 +90,6 @@ strips_wall = (
    .eachpoint(
       lambda loc: (
          cq.Workplane()
-         .rect(space_all, strip_width, centered=(False, True))
-         .center(-wall_thick, 0)
          .rect(space_all+ 2*wall_thick, strip_width + 2*wall_thick, centered=(False, True))
          .extrude(print_height)
          .val()
@@ -89,7 +101,7 @@ base_cutout = (
    cell_base.union(strips_wall)
    .cut(cell_cutout)
    .cut(strips_cut)
-).faces("<Z").chamfer(wall_thick/4)
+)#.faces("<Z").chamfer(wall_thick/4)
 
 connectors = (
    cq.Workplane()
@@ -106,7 +118,55 @@ connectors = (
 )
 base_connected = base_cutout.union(connectors)
 
+connector_width = hole_diam + wall_thick*2
+board_con = (
+   cq.Workplane()
+   .rect(connector_width, connector_width)
+   .extrude(board_connector_length)
+   .faces("<Z")
+   .workplane()
+   .rect(connector_width+lip_width, connector_width+lip_width)
+   .extrude(lip_width)
+   .edges("|Z")
+   .chamfer(wall_thick)
+   .faces(">Z")
+   .workplane()
+   .circle(hole_diam/2)
+   .cutBlind(-hole_depth)
+)
+board_con_outside = (
+   cq.Workplane()
+   .rect(connector_width + eps, connector_width + eps)
+   .extrude(print_height)
+   .edges("|Z")
+   .chamfer(wall_thick)
+)
+board_con_hull = (
+   cq.Workplane()
+   .rect(connector_width + 2 * (wall_thick + eps), connector_width + 2 * (wall_thick + eps))
+   .extrude(print_height)
+   .edges("|Z")
+   .chamfer(wall_thick)
+)
+
+con_placed = []
+for loc in board_con_locs:
+   con = board_con.translate(loc)
+   con_outside = board_con_outside.translate(loc)
+   con_placed.append(con)
+   hull = board_con_hull.translate(loc).cut(cell_base).cut(strips_cut)
+   base_connected = base_connected.union(hull).cut(con_outside)
+
+boundary_box = (
+   base_connected.workplane(centerOption="CenterOfBoundBox")
+   .box(1000, dist_segments, 1000,combine=False)
+)
+base_connected = base_connected.intersect(boundary_box)
+
 show_object(base_connected)
+show_object(con_placed)
 
-with open(r"/home/sgruen/Dokumente/bodenplatte/zellhalter_v2.step", "w") as fp:
-   cq.exporters.exportShape(cell_base, ExportTypes.STEP, fp)
+with open(r"/home/sgruen/Dokumente/bodenplatte/zellhalter_v2_base.step", "w") as fp:
+   cq.exporters.exportShape(base_connected, ExportTypes.STEP, fp)
+with open(r"/home/sgruen/Dokumente/bodenplatte/zellhalter_v2_connector.step", "w") as fp:
+   cq.exporters.exportShape(board_con, ExportTypes.STEP, fp)