import cadquery as cq from cadquery.occ_impl.exporters import ExportTypes from ocp_vscode import show, show_object twist_dist = 170 shift = 40 down_shift = 10 height = 25 width = 70 thickness = 1 adapter_legth = 25 stopper_cut_length=20 eps=0.1 pts = [ (0, 0), (0, width), (height, width), (height, width + thickness), (-thickness, width + thickness), (-thickness, -thickness), (height, -thickness), (height, 0), (0, 0), ] # Sweep a circle from diameter 2.0 to diameter 1.0 to diameter 2.0 along X axis length 10.0 + 10.0 sweep = ( cq.Workplane("ZX") .polyline(pts).close() .workplane(offset=twist_dist/3) .center(-down_shift/3, shift/3) .transformed(rotate=(-30, 0, 0)) .polyline(pts).close() .workplane(offset=twist_dist/3) .center(-down_shift/3, shift/3) .transformed(rotate=(-30, 0, 0)) .polyline(pts).close() .workplane(offset=twist_dist/3) .center(-down_shift/3, shift/3) .transformed(rotate=(-30, 0, 0)) .polyline(pts).close() .loft() )#.faces("X").shell(thickness) extended = ( sweep.faces(">X") .extrude(adapter_legth,combine=False) ) stopper_wall=extended.faces(">X").workplane(centerOption="CenterOfBoundBox").box(width+2*thickness,adapter_legth+thickness,thickness,combine=False) stopper_wall=extended.union(stopper_wall) cutout=( stopper_wall.faces(">X") .workplane(centerOption="CenterOfBoundBox") .center(0,thickness/2) .rect(width+2*thickness-stopper_cut_length,adapter_legth) .cutBlind(-thickness-eps) ) extended_cut=cutout.faces(">Y").workplane(centerOption="CenterOfBoundBox").circle(10).cutBlind(until=-80) # Translate the resulting solids so that they do not overlap and display them left to right result = extended_cut.union(sweep) show_object(result) with open(r"cell_measure_robot/feeder.step", "w") as fp: cq.exporters.exportShape(result, ExportTypes.STEP, fp)