#%% from build123d import * from ocp_vscode import * import copy #%% text = Text("z", font_size=8.0, font_path="/usr/share/fonts/truetype/ebgaramond/EBGaramond12-Bold.ttf", font_style=FontStyle.BOLD,) show(text) set_defaults(reset_camera=Camera.KEEP) #%% r=3.5 with BuildPart() as drops: # Start with the plan of the key cap and extrude it with BuildSketch() as plan: RegularPolygon(2.5,7,rotation=90) with BuildSketch(Plane.XY.offset(2)) as planb: Circle(r) loft() with BuildSketch(Plane.XY.offset(2)) as planc: Circle(r) extrude(amount=2) with BuildSketch() as txt: add(text) extrude(amount=0.2, mode=Mode.SUBTRACT) #chamfer(drops.edges(), length=0.05) mirror(about=Plane.XZ, mode=Mode.REPLACE) show(drops) # %% with BuildPart() as pezdrops: # Start with the plan of the key cap and extrude it with BuildSketch() as plan: RectangleRounded(15,8, 3) extrude(amount=5) with BuildSketch(Plane.XY) as planb: RectangleRounded(11,4, 0.5) with BuildSketch(Plane.XY.offset(2)) as planc: SlotCenterToCenter(7,2) loft(mode=Mode.SUBTRACT) fillet(pezdrops.faces().sort_by(Axis.Z)[0].edges(), radius=1) show(pezdrops) # %% with BuildPart() as mold: with Locations((0,0,1)): Box(108,108,3) with GridLocations(7+1, 8, 10, 10): add(copy.copy(drops), mode=Mode.SUBTRACT) show(mold) # %% with BuildPart() as pezmold: with Locations((0,0,2)): Box(116,112,7) with Locations((0,0,1.5)): Box(112,108,6,mode=Mode.SUBTRACT) with GridLocations(17, 10, 6, 10,align=(Align.CENTER, Align.CENTER)): add(copy.copy(pezdrops)) show(pezmold) # %% with BuildPart() as mold_for_mold: with Locations((0,0,1)): Box(114, 114, 6) with Locations((0,0,1)): Box(110,110,3, mode=Mode.SUBTRACT) with HexLocations(4,15,13): #with GridLocations(7+1, 8, 10, 10): add(copy.copy(drops), mode=Mode.ADD, rotation=(0,0,0)) with Locations((0,0,-2.5)): Box(110,110,4, mode=Mode.SUBTRACT) #add(mold, mode=Mode.SUBTRACT,rotation=180) show(mold_for_mold) # %% #export_step(mold_for_mold.part, "zdrops_mold_for_mold.step") # %% #export_step(pezmold.part, "pezmold.step") # %%