| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import cadquery as cq
- from cadquery.occ_impl.exporters import ExportTypes
- from ocp_vscode import show, show_object
- ###### Parameter #####
- a_thick = 1.7
- a_diam = 3.2
- a_gap_width = 1
- overhang_a_width = a_gap_width /2 * 0.9
- overhang_a_height = 3
- b_thick = 4.2
- b_diam = 3.2
- b_gap_width = a_gap_width
- overhang_b_width = b_gap_width /2 * 0.98
- overhang_b_height = overhang_a_height
- thick_eps = 0.1
- space_height = 4
- space_diam = 7
- overhang_top = 0.5
- print_height = 2.8
- spacer = cq.Workplane("XY").cylinder(space_height, space_diam/2)
- clip_a = (
- spacer.faces(">Z").workplane()
- .circle(a_diam/2-thick_eps).extrude(a_thick, combine=False)
- .faces(">Z").workplane()
- .circle(a_diam/2+overhang_a_width).workplane(offset=overhang_a_height+thick_eps)
- .circle(overhang_top).loft()
- .faces(">Z").workplane()
- .rect(a_gap_width, 100)
- .cutThruAll()
- )
- clip_b = (
- spacer.faces("<Z").workplane()
- .circle(b_diam/2-thick_eps).extrude(b_thick, combine=False)
- .faces("<Z").workplane()
- .circle(b_diam/2+overhang_b_width).workplane(offset=overhang_b_height+thick_eps)
- .circle(overhang_top).loft()
- .faces("<Z").workplane()
- .rect(b_gap_width, 100)
- .cutThruAll()
- )
- spacer = spacer.union(clip_a).union(clip_b)
- spacer_cut = spacer.cut(cq.Workplane("XY").box(100, print_height, 100))
- spacer = spacer.cut(spacer_cut)
- ############
- show_object(spacer)
- with open(r"/home/sgruen/Dokumente/bodenplatte/spacer.step", "w") as fp:
- cq.exporters.exportShape(spacer, ExportTypes.STEP, fp)
|