|
@@ -0,0 +1,84 @@
|
|
|
|
|
+
|
|
|
|
|
+import cadquery as cq
|
|
|
|
|
+from ocp_vscode import show, show_object
|
|
|
|
|
+from cadquery.occ_impl.exporters import ExportTypes
|
|
|
|
|
+
|
|
|
|
|
+rows = 19
|
|
|
|
|
+cols = 6
|
|
|
|
|
+row_dist = 90
|
|
|
|
|
+col_dist = 176
|
|
|
|
|
+
|
|
|
|
|
+thickness = 10
|
|
|
|
|
+
|
|
|
|
|
+default_dist_x = 550.75
|
|
|
|
|
+default_dist_y = 208.75
|
|
|
|
|
+result_dist_x = 4.88
|
|
|
|
|
+result_dist_y = 52.85
|
|
|
|
|
+
|
|
|
|
|
+center_x = -464.62
|
|
|
|
|
+center_y = 94.85
|
|
|
|
|
+
|
|
|
|
|
+hole_diam = 2.5
|
|
|
|
|
+hole_width = 160
|
|
|
|
|
+hole_height = 84
|
|
|
|
|
+ps_diam = 3
|
|
|
|
|
+duct_diam = 11
|
|
|
|
|
+
|
|
|
|
|
+num_per_powersupply = 3
|
|
|
|
|
+
|
|
|
|
|
+mountingplate = cq.importers.importStep("/home/sgruen/Dokumente/mountingplate.step")
|
|
|
|
|
+
|
|
|
|
|
+# holes_dxf = cq.importers.importDXF("/home/sgruen/Dokumente/Strom_TestLader_V1.1_edit_2.dxf")
|
|
|
|
|
+
|
|
|
|
|
+holes = (
|
|
|
|
|
+ cq.Workplane(origin=(center_x,center_y,0))
|
|
|
|
|
+ .center(hole_width/2, -hole_height/2)
|
|
|
|
|
+ .circle(hole_diam/2)
|
|
|
|
|
+ .center(-hole_width/2, 0)
|
|
|
|
|
+ .circle(hole_diam/2)
|
|
|
|
|
+ .center(-hole_width/2, 0)
|
|
|
|
|
+ .circle(hole_diam/2)
|
|
|
|
|
+ .center(0, hole_height)
|
|
|
|
|
+ .circle(hole_diam/2)
|
|
|
|
|
+ .center(hole_width/2, 0)
|
|
|
|
|
+ .circle(hole_diam/2)
|
|
|
|
|
+ .center(hole_width/2, 0)
|
|
|
|
|
+ .circle(hole_diam/2)
|
|
|
|
|
+ .extrude(-thickness)
|
|
|
|
|
+)
|
|
|
|
|
+power_supply = (
|
|
|
|
|
+ cq.Workplane(origin=(center_x,center_y,0))
|
|
|
|
|
+ .center(hole_width/2, -hole_height/2+10)
|
|
|
|
|
+ .circle(ps_diam/2)
|
|
|
|
|
+ .center(-152.5, 85)
|
|
|
|
|
+ .circle(ps_diam/2)
|
|
|
|
|
+ .extrude(-thickness)
|
|
|
|
|
+)
|
|
|
|
|
+duct = (
|
|
|
|
|
+ cq.Workplane(origin=(center_x,center_y,0))
|
|
|
|
|
+ .circle(duct_diam/2)
|
|
|
|
|
+ .extrude(-thickness)
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
|
|
+# holes_dxf = holes_dxf.translate((result_dist_x-default_dist_x, result_dist_y-default_dist_y, 0))
|
|
|
|
|
+mountingplate_holes = mountingplate
|
|
|
|
|
+
|
|
|
|
|
+for row in range(rows):
|
|
|
|
|
+ for col in range(cols):
|
|
|
|
|
+ y_offset = row * row_dist
|
|
|
|
|
+ x_offset = col * col_dist
|
|
|
|
|
+
|
|
|
|
|
+ hole_negative = holes.translate((x_offset, y_offset, 0))
|
|
|
|
|
+ mountingplate_holes = mountingplate_holes.cut(hole_negative)
|
|
|
|
|
+
|
|
|
|
|
+ duct_negative = duct.translate((x_offset, y_offset, 0))
|
|
|
|
|
+ mountingplate_holes = mountingplate_holes.cut(duct_negative)
|
|
|
|
|
+
|
|
|
|
|
+ if (col * rows + row) % num_per_powersupply is num_per_powersupply-1:
|
|
|
|
|
+ ps_negative = power_supply.translate((x_offset, y_offset, 0))
|
|
|
|
|
+ mountingplate_holes = mountingplate_holes.cut(ps_negative)
|
|
|
|
|
+
|
|
|
|
|
+# show_object(mountingplate_holes, name="mountingplate")
|
|
|
|
|
+
|
|
|
|
|
+with open(f"mountingplate_holes.step", "w") as fp:
|
|
|
|
|
+ cq.exporters.exportShape(mountingplate_holes, ExportTypes.STEP, fp)
|