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 cq_gears import ( SpurGear, Worm, HerringboneGear, RackGear, HerringboneRackGear, BevelGear, BevelGearPair, ) turn_width = 5 turn_length = 150 turn_height = 45 servo_diameter = 4.6 servo_height = 12 screw_diameter = 3.2 screw_head_diameter = 5.6 spur_gear = SpurGear(module=1.0, teeth_number=19, width=5.0, bore_d=5.0) drive_result = cq.Workplane("XY").gear(spur_gear) drive_result = drive_result.cylinder(turn_length, turn_width) turn_shaft_height = 10 turn_shaft_width = 8 turn_result = cq.Workplane("XY").box(turn_length, turn_height, turn_width) turn_result = ( turn_result.faces(">Z[0]") .workplane() .move(-(turn_length / 3.5), 0) .rect( 32.2 - (screw_head_diameter * 2) + 4, 37.9 - (screw_head_diameter * 2) + 4, forConstruction=True, ) .vertices() .cskHole(screw_diameter, screw_head_diameter, 83, depth=None) ) turn_result = ( turn_result.faces(">Z[0]") .workplane() .move((turn_length / 3.5), 0) .rect( 32.2 - (screw_head_diameter * 2) + 4, 37.9 - (screw_head_diameter * 2) + 4, forConstruction=True, ) .vertices() .cskHole(screw_diameter, screw_head_diameter, 83, depth=None) ) turn_result = ( turn_result.faces(">Z[0]") .workplane(offset=5) .center(0, 0) .cylinder(turn_shaft_height, turn_shaft_width / 2) ) turn_result = ( turn_result.faces(">Z[1]") .workplane(offset=(turn_shaft_height - (servo_height / 2))) .center(0, 0) .cylinder(servo_height, servo_diameter / 2, combine="cut") ) try: show_object(turn_result) except NameError: pass cq.exporters.export(turn_result, "/home/deck/model_files/robot_turn_part.step")