|
@@ -0,0 +1,94 @@
|
|
|
|
|
+import cadquery as cq
|
|
|
|
|
+from cadquery.occ_impl.exporters import ExportTypes
|
|
|
|
|
+
|
|
|
|
|
+from ocp_vscode import show, show_object
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+###### Parameter #####
|
|
|
|
|
+cells_per_row = 8
|
|
|
|
|
+rows = 2
|
|
|
|
|
+
|
|
|
|
|
+cell_diam = 18.44
|
|
|
|
|
+cell_length = 65
|
|
|
|
|
+dist_to_ground = 66.9
|
|
|
|
|
+space_all = 140
|
|
|
|
|
+space_single = space_all / (cells_per_row - 1)
|
|
|
|
|
+space_rows = 33.7
|
|
|
|
|
+
|
|
|
|
|
+strip_width = 10.2
|
|
|
|
|
+
|
|
|
|
|
+print_height = 10
|
|
|
|
|
+wall_thick = 1.5
|
|
|
|
|
+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_base = (
|
|
|
|
|
+ cq.Workplane()
|
|
|
|
|
+ .pushPoints(cell_locations)
|
|
|
|
|
+ .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)
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+)
|
|
|
|
|
+strips_cut = (
|
|
|
|
|
+ cq.Workplane()
|
|
|
|
|
+ .pushPoints(strip_locations)
|
|
|
|
|
+ .eachpoint(
|
|
|
|
|
+ lambda loc: (
|
|
|
|
|
+ cq.Workplane()
|
|
|
|
|
+ .rect(space_all + cell_diam/2, strip_width, centered=(False, True))
|
|
|
|
|
+ .extrude(print_height)
|
|
|
|
|
+ .val()
|
|
|
|
|
+ .located(loc)
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+)
|
|
|
|
|
+strips_wall = (
|
|
|
|
|
+ cq.Workplane()
|
|
|
|
|
+ .pushPoints(strip_locations)
|
|
|
|
|
+ .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()
|
|
|
|
|
+ .located(loc)
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+)
|
|
|
|
|
+cell_base_hull = (
|
|
|
|
|
+ cq.Workplane()
|
|
|
|
|
+ .pushPoints(cell_locations)
|
|
|
|
|
+ .eachpoint(
|
|
|
|
|
+ lambda loc: (
|
|
|
|
|
+ cq.Workplane()
|
|
|
|
|
+ .circle(cell_diam/2 + eps + wall_thick)
|
|
|
|
|
+ .extrude(print_height)
|
|
|
|
|
+ .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)
|
|
|
|
|
+
|
|
|
|
|
+show_object(cell_base)
|
|
|
|
|
+
|
|
|
|
|
+with open(r"/home/sgruen/Dokumente/bodenplatte/zellhalter_v2.step", "w") as fp:
|
|
|
|
|
+ cq.exporters.exportShape(cell_base, ExportTypes.STEP, fp)
|