import cadquery as cq from cqmore import Workplane from cqmore.curve import archimedeanSpiral, circle from cqmore.polygon import regularPolygon, star from random import randint, choice import functools as fnc import itertools as it wall_width = 12 length = 90 width = 150 height = 100 magnet_height = 27 magnet_width = 27 magnet_thickness = 5 bottom_thickness = 12 first_magnet_position = 35 second_magnet_position = -35 magnet_slot_offset = 10 second_slot_offset = -25 result = Workplane("front").box(length, width, height) result = ( result.workplane() .center(0, -bottom_thickness) .workplane() .box(length - wall_width, width - wall_width, height - wall_width, True, "cut") ) result = ( result.faces(">Z") .workplane(0, True) .moveTo(0, first_magnet_position) .rect(magnet_width, magnet_height) .cutBlind(magnet_thickness) ) result = ( result.faces(">Z") .workplane(0, True) .moveTo(0, magnet_slot_offset) .rect(magnet_width, magnet_height) .cutBlind(magnet_thickness) .faces(">Z") .moveTo(0, magnet_slot_offset) .rect(magnet_width, magnet_height) .extrude(2) ) result = ( result.faces(">Z") .workplane(0, True) .moveTo(0, second_magnet_position) .rect(magnet_width, magnet_height) .cutBlind(magnet_thickness) ) result = ( result.faces(">Z") .workplane(0, True) .moveTo(0, second_magnet_position + second_slot_offset) .rect(magnet_width, magnet_height) .cutBlind(magnet_thickness) .faces(">Z") .moveTo(0, second_magnet_position + second_slot_offset) .rect(magnet_width, magnet_height) .extrude(2) ) cq.exporters.export(result, "/home/deck/cad_files/tool_holder.step")