Jelajahi Sumber

add injetion moulding option

Silas Gruen 10 bulan lalu
induk
melakukan
1e5ad45006
1 mengubah file dengan 20 tambahan dan 7 penghapusan
  1. 20 7
      segment_gehauese/zellhalter_v2.py

+ 20 - 7
segment_gehauese/zellhalter_v2.py

@@ -29,6 +29,8 @@ board_connector_length = dist_to_ground + wall_thick
 lip_width = 1.5
 lip_thick = 1.5
 
+injection_mould = False
+
 ############
 
 cell_locs = [(x * space_single, y * space_rows) for x in range(0, cells_per_row) for y in range(0, rows)]
@@ -137,15 +139,19 @@ board_con = (
    .faces("+Y")
    .edges("|Z")
    .chamfer(wall_thick)
-   .faces("<Z")
-   .workplane()
-   .rect(connector_width+lip_width, connector_width)
-   .extrude(lip_width)
    .faces(">Z")
    .workplane()
    .circle(hole_diam/2)
    .cutBlind(-hole_depth)
 )
+if not injection_mould:
+   board_con = (
+      board_con
+      .faces("<Z")
+      .workplane()
+      .rect(connector_width+lip_width, connector_width)
+      .extrude(lip_width)
+   )
 board_con_outside = (
    cq.Workplane()
    .rect(connector_width + 2 * eps, connector_width + 2 * eps)
@@ -159,6 +165,7 @@ board_con_hull = (
    .chamfer(wall_thick)
 )
 
+base_connected = base_connected.rotateAboutCenter((1,0,0), 180)
 con_placed = []
 for location, angle in board_con_locs_with_rot:
    # Connector nur für Visualisierung
@@ -171,7 +178,12 @@ for location, angle in board_con_locs_with_rot:
    con_placed.append(con)
    # Verdickte Hülle für den Connector
    hull = board_con_hull.translate(location).cut(cell_base).cut(strips_cut)
-   base_connected = base_connected.union(hull).cut(con_outside)
+   base_connected = base_connected.union(hull)
+   if injection_mould:
+      base_connected = base_connected.union(con)
+   else:
+      base_connected = base_connected.cut(con_outside)
+
 
 # Begrenzungsbox für den gesamten Zellhalter (sonst schneidet man den nächsten Halter)
 boundary_box = (
@@ -185,5 +197,6 @@ show_object(con_placed)
 
 with open(r"zellhalter_v2_base.step", "w") as fp:
    cq.exporters.exportShape(base_connected, ExportTypes.STEP, fp)
-with open(r"zellhalter_v2_connector.step", "w") as fp:
-   cq.exporters.exportShape(board_con, ExportTypes.STEP, fp)
+if not injection_mould:
+   with open(r"zellhalter_v2_connector.step", "w") as fp:
+      cq.exporters.exportShape(board_con, ExportTypes.STEP, fp)