diff --git a/amp_case.py b/amp_case.py index 42507b9..f5c3a4b 100644 --- a/amp_case.py +++ b/amp_case.py @@ -11,6 +11,13 @@ import cadquery as cq import cqmore from math import ceil, floor +Workplane = cqmore.extend(Workplane) +Workplane.addSvgPath = addSvgPath + +headphone_paths, headphone_attributes = svg2paths( + "/home/deck/cad_files/svgs/headphones.svg" +) + side_width = 5 bottom_width = 5 middle_width = 2 @@ -54,9 +61,27 @@ result = ( result = ( result.workplane(offset=-6.4) .center((amp_width / 2) - (panel_width / 2) - 3, 0) - .box(panel_width, amp_width+5, amp_height+2.5) + .box(panel_width, amp_width + 5, amp_height + 2.5) ) +in_text = ( + Workplane("YZ") + .workplane(offset=(amp_width / 2) - 3.5) + .center(-15, -2) + .text("IN", 4, 1) + .rotateAboutCenter((1, 0, 0), 180) +) +out_text = ( + Workplane("YZ") + .workplane(offset=(amp_width / 2) - 3.5) + .center(15, -2) + .text("OUT", 4, 1) + .rotateAboutCenter((1, 0, 0), 180) +) + +result = result.cut(in_text) +result = result.cut(out_text) + panel_holes = ( Workplane("ZY") .workplane(offset=-(amp_length / 2)) @@ -99,15 +124,15 @@ back = back.center(31.5, 0).box(amp_width, amp_width + 9, amp_width, combine="cu # Slide in slot for top result = ( - result.workplane(offset=-(amp_height/2)-side_width-1) - .center(-70, -(amp_width/2)) + result.workplane(offset=-(amp_height / 2) - side_width - 1) + .center(-70, -(amp_width / 2)) .line(0, amp_width, forConstruction=True) .vertices() - .box(amp_length*2, 3.5, 1.0, combine="cut") - .workplane(offset=-(amp_height/2)-side_width-2) + .box(amp_length * 2, 3.5, 1.0, combine="cut") + .workplane(offset=-(amp_height / 2) - side_width - 2) .line(0, amp_width, forConstruction=True) .vertices() - .box(amp_length*2, 1.5, 1.5, combine="cut") + .box(amp_length * 2, 1.5, 1.5, combine="cut") ) result = result.cut(back_screws) @@ -116,7 +141,8 @@ cq.exporters.export(result, "/home/deck/model_files/amp_case.step") cq.exporters.export(back, "/home/deck/model_files/amp_case_back.step") try: - #show_object(back) + # show_object(back) + # show_object(front_text) show_object(result) except NameError: pass