소스 검색

finish connector base

Silas Gruen 1 년 전
부모
커밋
7e6b7169d4
1개의 변경된 파일35개의 추가작업 그리고 17개의 파일을 삭제
  1. 35 17
      segment_gehauese/zellhalter_v2.py

+ 35 - 17
segment_gehauese/zellhalter_v2.py

@@ -17,6 +17,8 @@ space_rows = 33.7
 
 strip_width = 10.2
 
+# board_connector_length = 
+
 print_height = 10
 wall_thick = 1.5
 eps = 0.1
@@ -24,28 +26,40 @@ eps = 0.1
 
 ############
 
-cell_locations = [(x * space_single, y * space_rows) for x in range(0, cells_per_row) for y in range(0, rows)]
-strip_locations = [(-cell_diam/4, y * space_rows) for y in range(0, rows)]
+cell_locs = [(x * space_single, y * space_rows) for x in range(0, cells_per_row) for y in range(0, rows)]
+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_base = (
    cq.Workplane()
-   .pushPoints(cell_locations)
+   .pushPoints(cell_locs)
    .eachpoint(
       lambda loc: (
          cq.Workplane()
          .circle(cell_diam/2 + eps + wall_thick)
-         .extrude(wall_thick)
-         .circle(cell_diam/2 + eps)
-         .circle(cell_diam/2 + eps + wall_thick)
          .extrude(print_height)
          .val()
          .located(loc)
       )
    )
 )
+cell_cutout = (
+   cq.Workplane()
+   .pushPoints(cell_locs)
+   .eachpoint(
+      lambda loc: (
+         cq.Workplane()
+         .circle(cell_diam/2 + eps )
+         .extrude(print_height-wall_thick)
+         .val()
+         .located(loc)
+      )
+   )
+)
+
 strips_cut = (
    cq.Workplane()
-   .pushPoints(strip_locations)
+   .pushPoints(strip_locs)
    .eachpoint(
       lambda loc: (
          cq.Workplane()
@@ -58,7 +72,7 @@ strips_cut = (
 )
 strips_wall = (
    cq.Workplane()
-   .pushPoints(strip_locations)
+   .pushPoints(strip_locs)
    .eachpoint(
       lambda loc: (
          cq.Workplane()
@@ -71,24 +85,28 @@ strips_wall = (
       )
    )
 )
-cell_base_hull = (
+base_cutout = (
+   cell_base.union(strips_wall)
+   .cut(cell_cutout)
+   .cut(strips_cut)
+).faces("<Z").chamfer(wall_thick/4)
+
+connectors = (
    cq.Workplane()
-   .pushPoints(cell_locations)
+   .pushPoints(connector_locs)
    .eachpoint(
       lambda loc: (
-         cq.Workplane()
-         .circle(cell_diam/2 + eps + wall_thick)
-         .extrude(print_height)
+         cq.Workplane().workplane(offset=wall_thick)
+         .rect(wall_thick, space_rows - cell_diam - wall_thick, centered=(False, True))
+         .extrude(print_height-wall_thick)
          .val()
          .located(loc)
       )
    )
 )
-strips_wall_cut = strips_wall.cut(cell_base_hull)
-
-cell_base_with_wall = cell_base.union(strips_wall_cut).cut(strips_cut)
+base_connected = base_cutout.union(connectors)
 
-show_object(cell_base)
+show_object(base_connected)
 
 with open(r"/home/sgruen/Dokumente/bodenplatte/zellhalter_v2.step", "w") as fp:
    cq.exporters.exportShape(cell_base, ExportTypes.STEP, fp)