# @author Arnaud Morin # SPDX-License-Identifier: Apache-2.0 # import cadquery as cq def lollipop(): # Antenna ant = (cq.Workplane("XZ") .box(17, 15, 11, centered=(True, True, True)) .fillet(1) ) cut = (cq.Workplane("XZ") .box(13.5, 10.7, 11, centered=(True, True, True))) ant = ant.cut(cut) # Add mass around the tube mass = (cq.Workplane("XZ") .polyline([ (0, 0), (2, 0), (13, 12), (0, 12), ]) .close() .extrude(10) .fillet(1) .translate((7, 5, -6))) ant = ant.union(mass) # Insert in tube ant = ant.cut( cq.Workplane("YZ") .circle(2.5) .extrude(4) .translate((6.75, 0, 0))) # Fillet on insert ant = ant.edges( cq.selectors.BoxSelector((6.5, -3, -3), (7.0, 3, 3))).fillet(1.0) # Rotate and translate ant = (ant.rotate((0, 0, 0), (0, 1, 0), 45) .translate((-8, 0, 9.5))) # Support on standoff sup = (cq.Workplane("XY") .polyline([ (-3, -3), (-0.5, -14), (4.2, -13), (2, -9), (2, -3), ]).close() .mirrorX() .extrude(4, both=True) .translate((0,0,1)) ) sup2 = (cq.Workplane("XY") .pushPoints([(2, 14), (2, -14)]) .circle(6.5/2) .extrude(5, both=True)) sup = sup.union(sup2) cut = (cq.Workplane("XY") .pushPoints([(2, 14), (2, -14)]) .circle(3.5/2) .extrude(5, both=True)) sup = sup.cut(cut) p = ant.union(sup) # Cut to have a flat printable object cut = (cq.Workplane("XY") .box(50, 50, 30, centered=(True, True, False)) .translate((0,0,-30)) ) p = p.cut(cut) # Cut to reduce weight cut = (cq.Workplane("XY") .box(50, 15, 30, centered=(False, True, True)) .translate((2,0,0)) ) p = p.cut(cut) # Translate back to ease next cut and hole p = (p.rotate((0, 0, 0), (0, 1, 0), -45) .translate((0, 0, -1))) # Hole in tube p = p.faces("