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 Workplane = cqmore.extend(Workplane) Workplane.addSvgPath = addSvgPath side_notch_distance = 3.3 # how far from the main part to the side notch side_notch_width = 4.0 # width of the side notch side_notch_thickness = 1.5 side_notch_height = 3 width = 57.5 height = 44.5 # 6.3 x 7.11 side_width = 3.7 side_height = 7.11 side_thickness = 1.9 tooth_dist_from_side = 7.45 result = Workplane() result = result.box(side_thickness, width, height) result = ( result.workplane(offset=-(width / 2) + side_width) .move(0, -(width / 2) + (side_width / 2) + tooth_dist_from_side) .line(0, width - tooth_dist_from_side * 2 - side_width, forConstruction=True) .vertices() .box(side_thickness, side_width, side_height) ) result = ( result.workplane(offset=(height / 2)) .box( side_thickness, width + side_notch_distance * 2 + side_notch_width * 2, side_notch_distance, ) .workplane(offset=(height / 2) - side_notch_width + 0.5) .move( 0, -(width / 2) - (side_notch_distance + side_notch_width / 2) + side_notch_distance / 2, ) .line( 0, width + side_notch_distance * 2 + side_notch_width - side_notch_distance, forConstruction=True, ) .vertices() .box(side_notch_thickness, side_notch_width - 2, side_notch_height) ) cq.exporters.export(result, "/home/deck/model_files/mask_battery_cover.step") try: show_object(result) except NameError: pass