codeCAD/water_blesser.py
2026-01-28 01:51:44 +01:00

107 lines
3.1 KiB
Python

#%%
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
with BuildPart() as glass_holder:
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.edges().group_by(Axis.Z)[5].filter_by(GeomType.CIRCLE), radius=1.6)
Cylinder(rg/2-10, 2,mode=Mode.SUBTRACT)
show(glass_holder)
# %%
show(glass_holder.edges().group_by(Axis.Z)[5].filter_by(GeomType.CIRCLE))
# %%