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 shelf_width = 4 holder_width = 15 holder_thickness = 3 shelf_hold_height = 20 hook_distance = 110 # from left side of left hook to right side of right hook hook_width = 2.8 hook_height = 5 hook_hole_diameter = 7.5 hook_hole_radius = hook_hole_diameter / 2 hook_cylinder_length = 8 holder_length = hook_distance + hook_hole_diameter + 5 result = Workplane() result = result.box(holder_length, holder_width, holder_thickness) result = ( result.center(-((holder_length / 2) - hook_hole_diameter * 1.3), 0) .workplane(offset=holder_thickness + 2) .line(hook_distance - hook_hole_radius * 2, 0, forConstruction=True) .vertices() .cylinder(hook_cylinder_length, hook_hole_radius) .workplane(offset=holder_thickness + 3) .move(0, 5) .line(hook_distance - hook_hole_radius * 2, 0, forConstruction=True) .vertices() .box(hook_width, hook_height, hook_width) .workplane(offset=-holder_thickness - 2) .move(holder_width, holder_width / 2) .line(holder_width * 5, 0, forConstruction=True) .vertices() .box(holder_width, shelf_hold_height, holder_thickness * 4) .workplane(offset=-holder_thickness + 1) .move(holder_width / 2, holder_width / 2 - 2) .line(holder_width * 5, 0, forConstruction=True) .vertices() .box(holder_width * 2, shelf_hold_height, shelf_width, combine="cut") ) cq.exporters.export(result, "/home/deck/model_files/screwdriver_holder.step") try: show_object(result) except NameError: pass