from cadquery import exporters from cq_warehouse.extensions import Workplane from cq_warehouse.fastener import * from cq_warehouse.thread import * from cqmore.polygon import regularPolygon, star import cadquery as cq import cqmore bottom_radius = 5 inner_screw_nsides = 6 Workplane = cqmore.extend(Workplane) simple = False screw = ButtonHeadScrew( size="M4-0.7", fastener_type="iso7380_1", length=10 * MM, simple=simple ) nut_result = ( Workplane() .makePolygon(star(outerRadius=bottom_radius, innerRadius=bottom_radius, n=8)) .extrude(5) ) scaled_screw = screw.scale(1.01) screw_result = ( Workplane() # .makePolygon(star(outerRadius=bottom_radius, innerRadius=13, n=8)) # .extrude(8) .union(scaled_screw) ) nut_result = nut_result.workplane(offset=3).threadedHole(screw, 5.5, simple=simple) box = Workplane().box(190, 100, 100) box = box.workplane(offset=0).move(10, 0).box(190, 90, 90, combine="cut") box = box.workplane(offset=0).move(50, 0).hole(7) try: show_object(scaled_screw) # show_object(box) # show_object(nut_result) except NameError: pass cq.exporters.export(screw_result, "/home/deck/model_files/robot_turn_part.step")