|
|
@@ -0,0 +1,63 @@
|
|
|
+
|
|
|
+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
|
|
|
+
|
|
|
+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")
|
|
|
+power_supply = (
|
|
|
+ cq.Workplane()
|
|
|
+ .center(-384.62, 65.85)
|
|
|
+ .circle(ps_diam/2)
|
|
|
+ .center(-152.5, 85)
|
|
|
+ .circle(ps_diam/2)
|
|
|
+ .extrude(-thickness)
|
|
|
+)
|
|
|
+duct = (
|
|
|
+ cq.Workplane()
|
|
|
+ .center(-464.62, 94.85)
|
|
|
+ .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
|
|
|
+
|
|
|
+ holes_moved = holes_dxf.translate((x_offset, y_offset, 0))
|
|
|
+ hole_negative = holes_moved.extrude(-thickness)
|
|
|
+ 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)
|