#%% from build123d import * from ocp_vscode import * #from bd_animation import AnimationGroup, clone, normalize_track import copy set_defaults(reset_camera=Camera.KEEP, render_joints=True, helper_scale=8) se = 30 sc = 14 with BuildPart() as electrode_holder: with BuildSketch() as sk: Rectangle(se,se,rotation=0) with GridLocations(se,se,2,2): Circle(3) Circle(1.25, mode=Mode.SUBTRACT) with PolarLocations(se/2,4): Rectangle(sc,sc,45,mode=Mode.SUBTRACT) Circle(8) with PolarLocations(se/2,4, 45): with Locations((10,0)): Rectangle(8,1.7, mode=Mode.SUBTRACT) with Locations((-4,0)): Rectangle(12,3, mode=Mode.SUBTRACT) fillet(sk.vertices(),radius=1.3) #fillet(sk.vertices(),radius=0.3) Rectangle(3,3,mode=Mode.SUBTRACT) extrude(amount=3) show(electrode_holder) # %% lg,wg = 43,22 bg = 3 with BuildPart() as arm: with BuildSketch() as sk: with BuildLine() as ll: l1=JernArc((0,0),(0,1),80,-135) Line(l1 @ 1, l1 @ 1 + (6, -4)) offset(amount=bg/2) make_face() with BuildLine() as lll: Spline((0,-wg),l1@1,tangents=[(0,1),l1%1],tangent_scalars=(1,1)) offset(amount=bg/2) make_face() with Locations((-lg/2-bg/2,-wg/2)): Rectangle(lg+2*bg,wg+2*bg) with Locations((0,bg/2)): Rectangle(lg,wg+bg,mode=Mode.SUBTRACT) with Locations((20,-30)): Circle(5) Circle(2.6,mode=Mode.SUBTRACT) with BuildLine() as llll: FilletPolyline((-lg,-wg-bg/2),(32,-37),(0,0),radius=5) offset(amount=bg/2) make_face() extrude(amount=3) show(arm.part) # %% export_step(arm.part, "arrm.step") export_stl(arm.part,"arm.stl") # %% export_step(electrode_holder.part, "electrodeholder.step") # %% wp=27 dp=15.5 hp = 14 tp=2 with BuildPart() as psu_holder: Box(wp+2*tp,dp+2*tp,hp+tp) with Locations((dp/2,0,tp/2)): Box(wp-10,dp,hp,mode=Mode.SUBTRACT) with Locations((-4.5/2,0,0.5)): Cylinder(13/2, 4.5,rotation=(0,90,0),mode=Mode.SUBTRACT) with Locations((-4.5/2,0,7)): Box(4.5,13,hp,mode=Mode.SUBTRACT) with Locations((-wp/2+3.2/2-tp,0,tp/2)): Box(3.2,9,hp,mode=Mode.SUBTRACT) show(psu_holder) # %% rg=74 rg1=83 rg2=68 rgr=2 with BuildPart() as glassholder_rod: with BuildLine(Plane.XZ) as ghp: FilletPolyline((rg/2+rgr,3),(rg/2+rgr,10),(rg/4,20),(rg/4,60),(rg1/2+rgr,114),\ (rg2/2+rgr,200),radius=10) with BuildSketch(Plane((rg/2+rgr,0,0),z_dir=(0,0,1))): Rectangle(rgr*2,rgr*2) sweep() # lower screw mounts with BuildSketch(): with Locations((rg/2,-2)): Circle(6) with Locations((rg/2+2,-4)): Circle(1.55,mode=Mode.SUBTRACT) extrude(amount=3) # upper screw mounts with BuildSketch(Plane.XY.offset(197)): with Locations((rg/2,-2)): Circle(6) with Locations((rg/2+2,-4)): Circle(1.55,mode=Mode.SUBTRACT) extrude(amount=3) Cylinder(rg/2,6,mode=Mode.SUBTRACT) with Locations((0,0,197)): Cylinder(rg2/2,6,mode=Mode.SUBTRACT) with Locations((rg2/2,8)): Box(30,12,500,mode=Mode.SUBTRACT) #with Locations((0,0,200)) show(glassholder_rod, ghp) # %% export_step(glassholder_rod.part, 'glassholder_rod.step') # %% with BuildPart() as glass_holder_base: with BuildSketch() as sk: Circle(rg/2+2) extrude(amount=4.5) with BuildSketch(Plane.XY.offset(4.5)) as sk: Circle(rg/2+2) with BuildSketch(Plane.XY.offset(15)) as sk: Circle(6) loft() with Locations((0,0,8.5)): Cylinder(rg/2-4,15,mode=Mode.SUBTRACT) with Locations((0,0,2.5)): Cylinder(rg/2,3,mode=Mode.SUBTRACT) with Locations((-rg/4-1,0,6)): Box(rg/2+2,rg+4,10,mode=Mode.SUBTRACT) fillet(glass_holder_base.edges().group_by(Axis.Z)[5].filter_by(GeomType.CIRCLE), radius=1.6) Cylinder(rg/2-10, 2,mode=Mode.SUBTRACT) with PolarLocations(rgr,3): with Locations((rg/2,-2,0)): Cylinder(6,1,align=[Align.CENTER,Align.CENTER,Align.MIN]) with Locations((rg/2+2,-4)): Cylinder(1.55,10,mode=Mode.SUBTRACT) show(glass_holder_base) # %% export_step(glass_holder_base.part, 'glassholder_base.step') #%% with BuildPart() as glassholder_top: with BuildSketch(Plane.XY.offset(200)): Circle(rg2/2+rgr*2) with Locations((-rg2/2+6,0)): Rectangle(14,rg) Circle(rg2/2,mode=Mode.SUBTRACT) with PolarLocations(rgr,3): with Locations((rg2/2,-2,0)): Circle(6) with Locations((rg2/2+2,-4)): Circle(1.55,mode=Mode.SUBTRACT) extrude(amount=4) with Locations((-rg2/2+4,-rg2/2-5,202),(-rg2/2+4,rg2/2+5,202)): Cylinder(5.6/2, 20, rotation=(90,0,0)) Cylinder(rg2/2, 500, mode=Mode.SUBTRACT) with Locations((0,0,205),(0,0,199)): Box(120,120,2,mode=Mode.SUBTRACT) show(glassholder_top) # %% export_step(glassholder_top.part, "glassholder_top.step") #%% with BuildPart() as glassstem_holder: with Locations((-8.5,0,0)): Box(10,rg/2,2) with PolarLocations(rg/4+2, 3): Box(4,4,100,mode=Mode.SUBTRACT) fillet(glassstem_holder.edges().group_by(Axis.X)[-1].filter_by(Axis.Z), radius=4) show(glassstem_holder) export_step(glassstem_holder.part, "glassstem_holder.step") # %% with BuildPart() as glass_holder: add(glass_holder_base) with PolarLocations(rgr,3): add(copy.copy(glassholder_rod)) add(glassholder_top) with Locations((0,0,50)): add(glassstem_holder) show(glass_holder) # %% show(glass_holder.edges().group_by(Axis.Z)[5].filter_by(GeomType.CIRCLE)) # %% def splintgen(m=1.45,h=7.2): with BuildPart() as snapfit_splint: with BuildSketch() as sn_sk: with BuildLine(): Polyline((0,0),(m+0.5,0),(m+0.5,1),(m,1),(m,h),(m+0.5,h),(m+0.5,h+0.5),\ (m,h+m),(m/2,h+m),(0,m*3),close=True) make_face() mirror(about=Plane.YZ) extrude(amount=m)#50% radius return snapfit_splint m3x7_splint = splintgen(h=8.5) show(m3x7_splint) #%% export_step(m3x7_splint.part, "m3x8_splint.step") # %% with BuildPart() as bearing_mount: d=19.4 t = 1 Cylinder(d/2+t,7+1) #Cylinder(d/2,7,mode=Mode.SUBTRACT) #Cylinder(d/2-1,9,mode=Mode.SUBTRACT) with Locations((-d/2-t,0,4.5)): Box(1,36,17) fillet(bearing_mount.edges(Select.NEW).filter_by(Axis.Z),radius=7) Cylinder(d/2,7,mode=Mode.SUBTRACT) Cylinder(d/2-1,9,mode=Mode.SUBTRACT) with Locations((-d/2-t,0,28.5)): Box(1,80,40) fillet(bearing_mount.edges(Select.NEW).filter_by(Axis.X),radius=10) with BuildSketch(Plane.YZ.offset(-d/2-t)): with Locations((0,28.5)): with GridLocations(12,6,6,6): RectangleRounded(10,4,1) with GridLocations(75,10,2,4): Circle(1.5) extrude(amount=2,mode=Mode.SUBTRACT,both=True) with Locations((d/2,0,0)): Box(10,10,10,mode=Mode.SUBTRACT) fillet(bearing_mount.edges(Select.NEW).filter_by(Axis.Z).group_by(Axis.X)[-1],radius=0.5) show(bearing_mount) # %% export_step(bearing_mount.part, "bearing_mount.step") # %%