You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.0 KiB

from cadquery import exporters
from cq_warehouse.extensions import Workplane
from cq_warehouse.fastener import *
from cq_warehouse.thread import *
from cqmore.curve import archimedeanSpiral, circle
from cqmore.polygon import regularPolygon, star
from cqmore.polyhedron import polarZonohedra, Polyhedron, superellipsoid
from svg_path import addSvgPath
from svgpathtools import svg2paths
import cadquery as cq
import cqmore
from math import ceil, floor
side_width = 5
bottom_width = 5
middle_width = 2
panel_width = 0.8
amp_bottom_height = 19 + bottom_width + middle_width # how tall the pcb is
battery_width = 26
battery_height = 17
amp_width = 62
amp_length = 60
amp_height = battery_height + amp_bottom_height
panel_component_diameter = 7.8
panel_distance = 10.5 + (
panel_component_diameter / 2
) # distance between each panel component
panel_dist_from_side = 2
panel_dist_from_bottom = 0 # how far the panel components are from the bottom
result = Workplane().box(amp_length, amp_width, middle_width)
result = (
result.workplane(offset=0)
.center(0, -(amp_width / 2))
.line(0, amp_width, forConstruction=True)
.vertices()
.box(amp_length, side_width, amp_height)
)
result = (
result.workplane(offset=amp_height / 2)
.center(0, amp_width / 2)
.box(amp_length, amp_width + bottom_width, bottom_width)
.workplane(offset=-10)
.move(-(amp_width / 2), 0)
.box(10, 10, 10, combine="cut")
)
result = (
result.workplane(offset=-7.8)
.center((amp_width / 2) - (panel_width / 2) - 1, 0)
.box(panel_width, amp_width, amp_height)
.faces("+Z")
.chamfer(0.9, 1)
)
panel_holes = (
Workplane("ZY")
.workplane(offset=-(amp_length / 2))
.center(panel_component_diameter + panel_dist_from_bottom, 0)
.line(0, panel_distance, forConstruction=True)
.vertices()
.cylinder(side_width, panel_component_diameter / 2)
)
panel_holes_2 = (
Workplane("ZY")
.workplane(offset=-(amp_length / 2))
.center(panel_component_diameter + panel_dist_from_bottom, 0)
.line(0, -(panel_distance), forConstruction=True)
.vertices()
.cylinder(side_width, panel_component_diameter / 2)
)
result = result.cut(panel_holes)
result = result.cut(panel_holes_2)
result = (
result.workplane()
.line(0, amp_width, forConstruction=True)
.vertices()
.cylinder(3, 5)
)
back = (
result.workplane(offset=-6.3)
.center(-(amp_width) + 2, 0)
.box(panel_width * 2.5, amp_width + side_width, amp_height + 2.5)
)
back_screws = (
Workplane("ZY")
.workplane(offset=(amp_length / 2))
.center(2, 0.0)
.rect(37, amp_width, forConstruction=True)
.vertices()
.cylinder(10, 0.8)
)
back = back.cut(back_screws)
back = back.center(31.5, 0).box(amp_width, amp_width + 9, amp_width, combine="cut")
result = result.cut(back_screws)
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(result)
except NameError:
pass