seperate projects

This commit is contained in:
Marius Unsel 2026-01-28 01:51:44 +01:00
parent be5dffa5c9
commit 95475ff590
3 changed files with 477 additions and 358 deletions

358
drops.py
View File

@ -45,7 +45,6 @@ with BuildPart() as pezdrops:
loft(mode=Mode.SUBTRACT)
fillet(pezdrops.faces().sort_by(Axis.Z)[0].edges(), radius=1)
show(pezdrops)
# %%
with BuildPart() as mold:
@ -90,360 +89,3 @@ show(mold_for_mold)
# %%
#export_step(pezmold.part, "pezmold.step")
# %%
nHoles = 10
vol_ml = 1.0 # millilitiers = 1/1000 * 10cm*10cm*10cm = 100mm*100mm*100mm/1000 = 1000mm³
vol = vol_ml * 1000
r = 4 # millimeters
ri = 2
rrod=1
rodlen=100
tol = 0.05
A = 3.14*r*r
t = 2*vol/A # liter/meter
wt = 1
l, w, h = (r*2+wt)*(nHoles+0.5)+8, t+8, (r+wt)*2
with BuildPart() as pumpcylindercutout:
with BuildSketch(Plane.XZ) as holes_sk:
Circle(r)
extrude(amount=t)
with BuildSketch(pumpcylindercutout.faces().sort_by(Axis.Y)[0]) as rodhole_sk:
Circle(rrod+tol)
extrude(amount=10)
chamfer(pumpcylindercutout.edges().sort_by(Axis.Y)[3],2)
with BuildSketch(pumpcylindercutout.faces().sort_by(Axis.Y)[0]) as rodhole_sk:
Circle(r)
Circle(rrod+2, mode=Mode.SUBTRACT)
extrude(amount=10)
show(pumpcylindercutout,pumpcylindercutout.edges().sort_by(Axis.Y)[2])
#%%
with BuildPart() as pumpcylinderblock:
Box(l,w,h)
f = pumpcylinderblock.faces()[5].offset(-t)
#with GridLocations()
with Locations((0,t/2+4)):
with GridLocations(r+wt+r,0,nHoles,1):
add(pumpcylindercutout,mode=Mode.SUBTRACT)
#chamfer(pumpcylinderblock.edges().group_by(Axis.Z)[-1].filter_by(GeomType.CIRCLE), 0.4)
RigidJoint("slide", joint_location=Location(Plane.XY))
with BuildSketch(pumpcylinderblock.faces().sort_by(Axis.Z)[-1].translate((0,5,0))):
RectangleRounded(l-10,r*2+0.1, 2)
extrude(amount=-r,mode=Mode.SUBTRACT)
with BuildSketch(Plane.XY.offset(h/2)) as holes:
with Locations((0,5,0)):
with GridLocations(l-6,w-6-10,2,2):
Circle(1.5)
extrude(amount=-h,mode=Mode.SUBTRACT)
with BuildSketch(Plane.XZ.offset(25)) as holes:
with GridLocations(l-6,h-5,2,1):
Circle(1.5)
extrude(amount=-h,mode=Mode.SUBTRACT)
show(pumpcylinderblock)
#%%
with BuildPart() as oese:
c=Cylinder(3,2,rotation=(0,90,0))
fillet(c.edges().filter_by(GeomType.CIRCLE), 0.9)
Cylinder(1.5,2,rotation=(0,90,0), mode=Mode.SUBTRACT)
show(oese)
#%%
with BuildPart() as pumpvalverod:
rodlen=60
#Cylinder(3,4)
#with Locations((0,0,rodlen/2-10)):
# Cylinder(rrod,rodlen)
with BuildSketch(Plane.XY) as sk:
with BuildLine() as outline:
d=2
hn=1
l1=CenterArc((0,-rrod),rrod,270,90)
l2=Line(l1@1,(rrod,hn))
l3=Line(l2@1,(rrod+d,hn+d))
l4=Line(l3@1,(rrod,hn+2*d))
l5=Line(l4@1,(rrod,rodlen))
l6=CenterArc((0,rodlen),rrod,0,90)
l7=Line(l6@1,l1@0)
make_face()
revolve(axis=Axis.Y)
fillet(pumpvalverod.edges().sort_by(Axis.Y)[5],0.5)
with Locations((0,rodlen-3,0),(0,rodlen-9,0)):
with Locations((-rrod,0,0),(rrod,0,0)):
Box(rrod,3,4, mode=Mode.SUBTRACT)
show(pumpvalverod)
# %%
with BuildPart() as pumpcylinder:
rodlen=50
clen=8
elen=10
slen= 20
dy=-13
with BuildSketch(Plane.XZ.offset(dy)) as cl_sk:
Circle(r)
Circle(ri,mode=Mode.SUBTRACT)
extrude(amount=clen)
chamfer(pumpcylinder.edges().group_by(Axis.Y)[0][1],1)
with BuildSketch(pumpcylinder.faces().sort_by(Axis.Y)[-1]) as rods_sk:
with PolarLocations(r-(r-ri)/2,3,90):
Circle((r-ri)/2)
extrude(amount=slen)
with BuildSketch(Plane.XZ.offset(dy-slen-clen)) as cl_sk:
Circle(r)
Circle(rrod+0.05, mode=Mode.SUBTRACT)
extrude(amount=elen)
with BuildSketch(pumpcylinder.faces().sort_by(Axis.Y)[-1]) as rods_sk:
with PolarLocations(r-(r-ri)/2,2,0):
Rectangle((r-ri)/2,r)
#Circle((r-ri)/2)
extrude(amount=rodlen-clen-slen-elen)
with Locations((0,rodlen-1.5,r-0.25),(0,rodlen-1.5,-r+0.25)):
Box(15,3,5,mode=Mode.SUBTRACT)
show(pumpcylinder,pumpvalverod)
#%%
# MACHINE ASSEMBLY
openstate = False
pumped = True
trlen =2
pumplen=5
loc_rods = (0,-18-openstate*trlen+pumped*pumplen,0)
loc_cyls = (0,-20-openstate*trlen+pumped*pumplen,0)
with BuildPart() as pumpcylinderrods:
with Locations(loc_rods):
with GridLocations(r+wt+r,0,nHoles,1):
add(copy.copy(pumpvalverod))
with BuildPart() as pumpcylinders:
with Locations(loc_cyls):
with GridLocations(r+wt+r,0,nHoles,1):
add(copy.copy(pumpcylinder),rotation=(0,0,0),)
LinearJoint("cylinders", axis=Axis.Z, linear_range=(-t, t))
pumpcylinderblock.part.joints["slide"].connect_to(pumpcylinders.joints["cylinders"])
show(pumpcylinderblock,pumpcylinderrods,pumpcylinders,render_joints=True)#, pumpcylindercutout)# %%
#%%
with BuildPart() as nozzle:
#with BuildLine(Plane.XZ) as pipe:
# RadiusArc((0,0),(-10,-10,), -10)
dn=10
with BuildSketch(Plane.XZ) as profile:
Circle(rrod+3)
with BuildSketch(Plane.XY.offset(-dn).rotated((-45,0,0))) as endprofile:
with Locations((0,-dn)):
Circle(rrod+1)
#sweep(sections=[profile.sketch, endprofile.sketch], path=pipe)
loft()
#offset(amount=3,openings=[nozzle.faces().sort_by(Axis.X)[-1], nozzle.faces().sort_by(Axis.Z)[0]],side=Side.LEFT,)
e= nozzle.edges().sort_by(Axis.Z)[0]
fillet(e, radius=0.7)
with BuildSketch(Plane.XZ) as profile:
Circle(rrod)
with BuildSketch(Plane.XY.offset(-dn).rotated((-45,0,0))) as endprofile:
with Locations((0,-dn)):
Circle(rrod)
#sweep(sections=[profile.sketch, endprofile.sketch], path=pipe)
loft(mode=Mode.SUBTRACT)
show(e,nozzle)
# %%
with BuildPart() as nozzleplate:
tp = 2
with Locations((0,-w/2-tp/2,0)):
Box(l,tp,h)
with Locations((0,-w/2-tp,0)):
with GridLocations(r+wt+r,0,nHoles,1):
add(copy.copy(nozzle.part),rotation=(0,0,0))
with Locations((0,-w/2-tp/2,0)):
with GridLocations(r+wt+r,0,nHoles,1):
Cylinder(rrod,tp,mode=Mode.SUBTRACT,rotation=(90,0,0))
show(pumpcylinderblock, nozzleplate)
#%%
with BuildPart() as rodcollector:
loc_col=list(loc_rods)
dyc = rodlen-14-openstate*trlen +pumped*pumplen#+ loc_col[1]
loc_col[1] = dyc
loc_col[2]=-2
with Locations(tuple(loc_col)):
Box(l,10,2)
with GridLocations(r+wt+r,0,nHoles,1):
with Locations((-rrod,dyc-3,0), (rrod,dyc-3,0),(-rrod,dyc+3,0), (rrod,dyc+3,0)):
Box(rrod,3,rrod*2)
with Locations((-rrod*1.5,dyc,0), (rrod*1.5,dyc,0)):
Box(rrod,10,rrod*2)
with Locations((-rrod*4,dyc-2.5,-2), (rrod*4,dyc-2.5,-2)):
Box(4*rrod,5,2,mode=Mode.SUBTRACT)
#fillet(rodcollector.edges(Select.LAST).group_by(Axis.Z)[0].filter_by(lambda a: a.length==10), radius=1)
show(rodcollector)
#%%
with BuildPart() as cylindercollector:
dyc = rodlen-21.5 +pumped*pumplen
with Locations((0,dyc,1.7),(0,dyc,-1.7)):
Box(l,3-0.1,0.77)
with Locations((0,dyc,3),(0,dyc,-3)):
Box(l+20,10, 2)
with Locations((0,dyc,0),(0,dyc,0)):
with GridLocations(l+10,0,2,1,):
Cylinder(3.1/2,20,mode=Mode.SUBTRACT)
show(rodcollector,cylindercollector,nozzleplate,pumpcylinderblock,pumpcylinderrods,pumpcylinders)#, pumpcylindercutout)
# %%
show(rodcollector.edges(Select.LAST).group_by(Axis.Z)[0].filter_by(lambda a: a.length==10))
# %%
with BuildPart() as hopper:
with BuildSketch(Plane.XY.offset(h/2)) as down_sk:
with Locations((0,5)):
Rectangle(l-8,15)
with BuildSketch(Plane.XY.offset(160).rotated((-45,0,0))) as up_sk:
with Locations((0,50)):
Rectangle(230,200)
loft()
offset(amount=-1, openings=[hopper.faces().sort_by(Axis.Z)[0],\
hopper.faces().sort_by(Axis.Z)[-1]])
with BuildSketch(Plane.XY.offset(h/2)) as downs_sk:
Rectangle(l,w)
with Locations((0,5)):
Rectangle(l-10,20, mode=Mode.SUBTRACT)
extrude(amount=1)
with BuildSketch(Plane.XY.offset(h/2+2)) as holes:
with Locations((0,5,0)):
with GridLocations(l-6,w-6-10,2,2):
Circle(1.5)
extrude(amount=-h,mode=Mode.SUBTRACT)
#show(hopper)
show(rodcollector,cylindercollector,nozzleplate,pumpcylinderblock,pumpcylinderrods,pumpcylinders,hopper,render_joints=True)#, pumpcylindercutout)# %%
# %%
# %%
hopperblock = pumpcylinderblock.part + hopper.part
show(hopperblock)
# %%
with BuildPart() as stand:
ws = 120
wsx=60
with Locations((0,0,-h/2)):
Box(wsx,ws,4)
Box(wsx-4,ws-4,4,mode=Mode.SUBTRACT)
Box(wsx,4,4)
Box(4,ws,4)
with Locations((0,0,-1)):
Box(l+2,w+2,h+2)
Box(l,w,h, mode=Mode.SUBTRACT)
with BuildSketch(Plane.XY.offset(-(h+2)/2+3)):
RectangleRounded(l-3,w-3,3)
extrude(amount=-10, mode=Mode.SUBTRACT)
with BuildPart() as standfoot:
hs=50
ws=12
Box(ws,ws,hs)
ds=2
with Locations((-ds,-ds,0)):
Box(ws-ds,ws-ds,hs,mode=Mode.SUBTRACT)
with Locations((0,0,hs/2-2)):
Box(ws,4,4,mode=Mode.SUBTRACT)
Box(4,ws,4,mode=Mode.SUBTRACT)
#extrude(amount=4)
#offset(amount=-1.9, openings=[stand.faces().sort_by(Axis.Z)[-1]])
show(standfoot)
# %%
#export_step(hopperblock, "machineparts/hopperblock.step")
#export_step(stand.part, "machineparts/stand.step")
#export_step(standfoot.part, "machineparts/standfoot.step")
#export_step(pumpvalverod.part, "machineparts/valverod.step")
#export_step(pumpcylinder.part, "machineparts/pumpcylinder.step")
# %%
with BuildPart() as idb_holder:
Box(24,46,8)
with Locations((0,0,1)):
with GridLocations(7,7,3,6):
Cylinder(2.3,6,mode=Mode.SUBTRACT)
fillet(idb_holder.edges().filter_by(GeomType.CIRCLE), radius=1)
fillet(idb_holder.edges().filter_by(Axis.Z), radius=5)
fillet(idb_holder.edges().group_by(Axis.Z)[-1].filter_by(GeomType.LINE)[0], radius=1.5)
show(idb_holder)
# %%
export_step(idb_holder.part, "idb_holder.step")
# %%
def step_profile(stepfile="/home/hbrs/Downloads/tmp/I_slot_5_20x40.stp"):
iprofile = import_step(stepfile)
iface = iprofile.faces().sort_by(Axis.Z)[0]
def buildfn(length=50):
with BuildPart() as profile:
with BuildSketch() as profile_sk:
add(iface)
extrude(amount=length)
return Pos(0,13.3765,0)*Rot(0,0,90)*profile.part
return buildfn
iprofile=step_profile()
# %%
hp = 260
w = 240
w1 = w+40
w2 =hp+20
w3 = hp + 40
profiles= [ \
Pos(0,0,0)*Rot(0,0,90)*iprofile(hp), \
Pos(w1,0,0)*Rot(0,0,90)*iprofile(hp), \
Pos(0,w2,0)*Rot(0,0,90)*iprofile(hp), \
Pos(w1,w2,0)*Rot(0,0,90)*iprofile(hp), \
Pos(0,w2,0)*Rot(90,90,0)*iprofile(w), \
Pos(0,0,0)*Rot(90,90,0)*iprofile(w), \
Pos(-40,20,40)*Rot(-90,0,0)*iprofile(hp), \
Pos(hp,20,40)*Rot(-90,0,0)*iprofile(hp), \
Pos(0,0,w2)*Rot(-90,0,90)*iprofile(w3), \
Pos(w2,0,w2)*Rot(-90,0,90)*iprofile(w3), \
Pos(w2/2,0,60)*Rot(-90,0,90)*iprofile(w3), \
]
show(*profiles)#, hopperblock)
# %%
#ASSEMBLY
extruder = Compound(label="Extruder",children=[rodcollector.part,cylindercollector.part,nozzleplate.part,\
pumpcylinderblock.part,pumpcylinderrods.part,pumpcylinders.part,hopper.part])
extruder=Pos(120,170,168)*Rot(45,0,0)*extruder
#extruder.translate((hp/2,0,0))
show(*profiles,extruder)#, pumpcylindercutout)# %%
# %%
railpath = "/home/hbrs/Downloads/8381K54_Miniature Ball Bearing Carriage and Guide Rail.STEP"
carriagepath = "/home/hbrs/Downloads/6725K531_12 mm Wide x 200 mm Long Rail for Ball Bearing Carriage.STEP"
rail = import_step(railpath)
carriage = import_step(carriagepath)
show(carriage)
# %%
#cmpds = rail.compound()
shapes = rail.entities(topo_type=Part)
# %# %%
len(shapes)# %%
# %%
show(shapes[0])
# %%

371
drops_machine.py Normal file
View File

@ -0,0 +1,371 @@
from build123d import *
from ocp_vscode import *
from bd_animation import AnimationGroup, clone, normalize_track
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, render_joints=True, helper_scale=8)
nHoles = 10
vol_ml = 1.0 # millilitiers = 1/1000 * 10cm*10cm*10cm = 100mm*100mm*100mm/1000 = 1000mm³
vol = vol_ml * 1000
r = 4 # millimeters
ri = 2
rrod=1
rodlen=100
tol = 0.05
A = 3.14*r*r
t = 2*vol/A # liter/meter
wt = 1
l, w, h = (r*2+wt)*(nHoles+0.5)+8, t+8, (r+wt)*2
with BuildPart() as pumpcylindercutout:
with BuildSketch(Plane.XZ) as holes_sk:
Circle(r)
extrude(amount=t)
with BuildSketch(pumpcylindercutout.faces().sort_by(Axis.Y)[0]) as rodhole_sk:
Circle(rrod+tol)
extrude(amount=10)
chamfer(pumpcylindercutout.edges().sort_by(Axis.Y)[3],2)
with BuildSketch(pumpcylindercutout.faces().sort_by(Axis.Y)[0]) as rodhole_sk:
Circle(r)
Circle(rrod+2, mode=Mode.SUBTRACT)
extrude(amount=10)
show(pumpcylindercutout,pumpcylindercutout.edges().sort_by(Axis.Y)[2])
#%%
with BuildPart() as pumpcylinderblock:
Box(l,w,h)
f = pumpcylinderblock.faces()[5].offset(-t)
#with GridLocations()
with Locations((0,t/2+4)):
with GridLocations(r+wt+r,0,nHoles,1):
add(pumpcylindercutout,mode=Mode.SUBTRACT)
#chamfer(pumpcylinderblock.edges().group_by(Axis.Z)[-1].filter_by(GeomType.CIRCLE), 0.4)
RigidJoint("slide", joint_location=Location(Plane.XY))
with BuildSketch(pumpcylinderblock.faces().sort_by(Axis.Z)[-1].translate((0,5,0))):
RectangleRounded(l-10,r*2+0.1, 2)
extrude(amount=-r,mode=Mode.SUBTRACT)
with BuildSketch(Plane.XY.offset(h/2)) as holes:
with Locations((0,5,0)):
with GridLocations(l-6,w-6-10,2,2):
Circle(1.5)
extrude(amount=-h,mode=Mode.SUBTRACT)
with BuildSketch(Plane.XZ.offset(25)) as holes:
with GridLocations(l-6,h-5,2,1):
Circle(1.5)
extrude(amount=-h,mode=Mode.SUBTRACT)
show(pumpcylinderblock)
#%%
with BuildPart() as oese:
c=Cylinder(3,2,rotation=(0,90,0))
fillet(c.edges().filter_by(GeomType.CIRCLE), 0.9)
Cylinder(1.5,2,rotation=(0,90,0), mode=Mode.SUBTRACT)
show(oese)
#%%
with BuildPart() as pumpvalverod:
rodlen=60
#Cylinder(3,4)
#with Locations((0,0,rodlen/2-10)):
# Cylinder(rrod,rodlen)
with BuildSketch(Plane.XY) as sk:
with BuildLine() as outline:
d=2
hn=1
l1=CenterArc((0,-rrod),rrod,270,90)
l2=Line(l1@1,(rrod,hn))
l3=Line(l2@1,(rrod+d,hn+d))
l4=Line(l3@1,(rrod,hn+2*d))
l5=Line(l4@1,(rrod,rodlen))
l6=CenterArc((0,rodlen),rrod,0,90)
l7=Line(l6@1,l1@0)
make_face()
revolve(axis=Axis.Y)
fillet(pumpvalverod.edges().sort_by(Axis.Y)[5],0.5)
with Locations((0,rodlen-3,0),(0,rodlen-9,0)):
with Locations((-rrod,0,0),(rrod,0,0)):
Box(rrod,3,4, mode=Mode.SUBTRACT)
show(pumpvalverod)
# %%
with BuildPart() as pumpcylinder:
rodlen=50
clen=8
elen=10
slen= 20
dy=-13
with BuildSketch(Plane.XZ.offset(dy)) as cl_sk:
Circle(r)
Circle(ri,mode=Mode.SUBTRACT)
extrude(amount=clen)
chamfer(pumpcylinder.edges().group_by(Axis.Y)[0][1],1)
with BuildSketch(pumpcylinder.faces().sort_by(Axis.Y)[-1]) as rods_sk:
with PolarLocations(r-(r-ri)/2,3,90):
Circle((r-ri)/2)
extrude(amount=slen)
with BuildSketch(Plane.XZ.offset(dy-slen-clen)) as cl_sk:
Circle(r)
Circle(rrod+0.05, mode=Mode.SUBTRACT)
extrude(amount=elen)
with BuildSketch(pumpcylinder.faces().sort_by(Axis.Y)[-1]) as rods_sk:
with PolarLocations(r-(r-ri)/2,2,0):
Rectangle((r-ri)/2,r)
#Circle((r-ri)/2)
extrude(amount=rodlen-clen-slen-elen)
with Locations((0,rodlen-1.5,r-0.25),(0,rodlen-1.5,-r+0.25)):
Box(15,3,5,mode=Mode.SUBTRACT)
show(pumpcylinder,pumpvalverod)
#%%
# MACHINE ASSEMBLY
openstate = False
pumped = True
trlen =2
pumplen=5
loc_rods = (0,-18-openstate*trlen+pumped*pumplen,0)
loc_cyls = (0,-20-openstate*trlen+pumped*pumplen,0)
with BuildPart() as pumpcylinderrods:
with Locations(loc_rods):
with GridLocations(r+wt+r,0,nHoles,1):
add(copy.copy(pumpvalverod))
with BuildPart() as pumpcylinders:
with Locations(loc_cyls):
with GridLocations(r+wt+r,0,nHoles,1):
add(copy.copy(pumpcylinder),rotation=(0,0,0),)
LinearJoint("cylinders", axis=Axis.Z, linear_range=(-t, t))
pumpcylinderblock.part.joints["slide"].connect_to(pumpcylinders.joints["cylinders"])
show(pumpcylinderblock,pumpcylinderrods,pumpcylinders,render_joints=True)#, pumpcylindercutout)# %%
#%%
with BuildPart() as nozzle:
#with BuildLine(Plane.XZ) as pipe:
# RadiusArc((0,0),(-10,-10,), -10)
dn=10
with BuildSketch(Plane.XZ) as profile:
Circle(rrod+3)
with BuildSketch(Plane.XY.offset(-dn).rotated((-45,0,0))) as endprofile:
with Locations((0,-dn)):
Circle(rrod+1)
#sweep(sections=[profile.sketch, endprofile.sketch], path=pipe)
loft()
#offset(amount=3,openings=[nozzle.faces().sort_by(Axis.X)[-1], nozzle.faces().sort_by(Axis.Z)[0]],side=Side.LEFT,)
e= nozzle.edges().sort_by(Axis.Z)[0]
fillet(e, radius=0.7)
with BuildSketch(Plane.XZ) as profile:
Circle(rrod)
with BuildSketch(Plane.XY.offset(-dn).rotated((-45,0,0))) as endprofile:
with Locations((0,-dn)):
Circle(rrod)
#sweep(sections=[profile.sketch, endprofile.sketch], path=pipe)
loft(mode=Mode.SUBTRACT)
show(e,nozzle)
# %%
with BuildPart() as nozzleplate:
tp = 2
with Locations((0,-w/2-tp/2,0)):
Box(l,tp,h)
with Locations((0,-w/2-tp,0)):
with GridLocations(r+wt+r,0,nHoles,1):
add(copy.copy(nozzle.part),rotation=(0,0,0))
with Locations((0,-w/2-tp/2,0)):
with GridLocations(r+wt+r,0,nHoles,1):
Cylinder(rrod,tp,mode=Mode.SUBTRACT,rotation=(90,0,0))
show(pumpcylinderblock, nozzleplate)
#%%
with BuildPart() as rodcollector:
loc_col=list(loc_rods)
dyc = rodlen-14-openstate*trlen +pumped*pumplen#+ loc_col[1]
loc_col[1] = dyc
loc_col[2]=-2
with Locations(tuple(loc_col)):
Box(l,10,2)
with GridLocations(r+wt+r,0,nHoles,1):
with Locations((-rrod,dyc-3,0), (rrod,dyc-3,0),(-rrod,dyc+3,0), (rrod,dyc+3,0)):
Box(rrod,3,rrod*2)
with Locations((-rrod*1.5,dyc,0), (rrod*1.5,dyc,0)):
Box(rrod,10,rrod*2)
with Locations((-rrod*4,dyc-2.5,-2), (rrod*4,dyc-2.5,-2)):
Box(4*rrod,5,2,mode=Mode.SUBTRACT)
#fillet(rodcollector.edges(Select.LAST).group_by(Axis.Z)[0].filter_by(lambda a: a.length==10), radius=1)
show(rodcollector)
#%%
with BuildPart() as cylindercollector:
dyc = rodlen-21.5 +pumped*pumplen
with Locations((0,dyc,1.7),(0,dyc,-1.7)):
Box(l,3-0.1,0.77)
with Locations((0,dyc,3),(0,dyc,-3)):
Box(l+20,10, 2)
with Locations((0,dyc,0),(0,dyc,0)):
with GridLocations(l+10,0,2,1,):
Cylinder(3.1/2,20,mode=Mode.SUBTRACT)
show(rodcollector,cylindercollector,nozzleplate,pumpcylinderblock,pumpcylinderrods,pumpcylinders)#, pumpcylindercutout)
# %%
show(rodcollector.edges(Select.LAST).group_by(Axis.Z)[0].filter_by(lambda a: a.length==10))
# %%
with BuildPart() as hopper:
with BuildSketch(Plane.XY.offset(h/2)) as down_sk:
with Locations((0,5)):
Rectangle(l-8,15)
with BuildSketch(Plane.XY.offset(160).rotated((-45,0,0))) as up_sk:
with Locations((0,50)):
Rectangle(230,200)
loft()
offset(amount=-1, openings=[hopper.faces().sort_by(Axis.Z)[0],\
hopper.faces().sort_by(Axis.Z)[-1]])
with BuildSketch(Plane.XY.offset(h/2)) as downs_sk:
Rectangle(l,w)
with Locations((0,5)):
Rectangle(l-10,20, mode=Mode.SUBTRACT)
extrude(amount=1)
with BuildSketch(Plane.XY.offset(h/2+2)) as holes:
with Locations((0,5,0)):
with GridLocations(l-6,w-6-10,2,2):
Circle(1.5)
extrude(amount=-h,mode=Mode.SUBTRACT)
#show(hopper)
show(rodcollector,cylindercollector,nozzleplate,pumpcylinderblock,pumpcylinderrods,pumpcylinders,hopper,render_joints=True)#, pumpcylindercutout)# %%
# %%
# %%
hopperblock = pumpcylinderblock.part + hopper.part
show(hopperblock)
# %%
with BuildPart() as stand:
ws = 120
wsx=60
with Locations((0,0,-h/2)):
Box(wsx,ws,4)
Box(wsx-4,ws-4,4,mode=Mode.SUBTRACT)
Box(wsx,4,4)
Box(4,ws,4)
with Locations((0,0,-1)):
Box(l+2,w+2,h+2)
Box(l,w,h, mode=Mode.SUBTRACT)
with BuildSketch(Plane.XY.offset(-(h+2)/2+3)):
RectangleRounded(l-3,w-3,3)
extrude(amount=-10, mode=Mode.SUBTRACT)
with BuildPart() as standfoot:
hs=50
ws=12
Box(ws,ws,hs)
ds=2
with Locations((-ds,-ds,0)):
Box(ws-ds,ws-ds,hs,mode=Mode.SUBTRACT)
with Locations((0,0,hs/2-2)):
Box(ws,4,4,mode=Mode.SUBTRACT)
Box(4,ws,4,mode=Mode.SUBTRACT)
#extrude(amount=4)
#offset(amount=-1.9, openings=[stand.faces().sort_by(Axis.Z)[-1]])
show(standfoot)
# %%
#export_step(hopperblock, "machineparts/hopperblock.step")
#export_step(stand.part, "machineparts/stand.step")
#export_step(standfoot.part, "machineparts/standfoot.step")
#export_step(pumpvalverod.part, "machineparts/valverod.step")
#export_step(pumpcylinder.part, "machineparts/pumpcylinder.step")
# %%
with BuildPart() as idb_holder:
Box(24,46,8)
with Locations((0,0,1)):
with GridLocations(7,7,3,6):
Cylinder(2.3,6,mode=Mode.SUBTRACT)
fillet(idb_holder.edges().filter_by(GeomType.CIRCLE), radius=1)
fillet(idb_holder.edges().filter_by(Axis.Z), radius=5)
fillet(idb_holder.edges().group_by(Axis.Z)[-1].filter_by(GeomType.LINE)[0], radius=1.5)
show(idb_holder)
# %%
export_step(idb_holder.part, "idb_holder.step")
# %%
def step_profile(stepfile="/home/hbrs/Downloads/tmp/I_slot_5_20x40.stp"):
iprofile = import_step(stepfile)
iface = iprofile.faces().sort_by(Axis.Z)[0]
def buildfn(length=50):
with BuildPart() as profile:
with BuildSketch() as profile_sk:
add(iface)
extrude(amount=length)
return Pos(0,13.3765,0)*Rot(0,0,90)*profile.part
return buildfn
iprofile=step_profile()
# %%
hp = 260
w = 240
w1 = w+40
w2 =hp+20
w3 = hp + 40
profiles= [ \
Pos(0,0,0)*Rot(0,0,90)*iprofile(hp), \
Pos(w1,0,0)*Rot(0,0,90)*iprofile(hp), \
Pos(0,w2,0)*Rot(0,0,90)*iprofile(hp), \
Pos(w1,w2,0)*Rot(0,0,90)*iprofile(hp), \
Pos(0,w2,0)*Rot(90,90,0)*iprofile(w), \
Pos(0,0,0)*Rot(90,90,0)*iprofile(w), \
Pos(-40,20,40)*Rot(-90,0,0)*iprofile(hp), \
Pos(hp,20,40)*Rot(-90,0,0)*iprofile(hp), \
Pos(0,0,w2)*Rot(-90,0,90)*iprofile(w3), \
Pos(w2,0,w2)*Rot(-90,0,90)*iprofile(w3), \
Pos(w2/2,0,60)*Rot(-90,0,90)*iprofile(w3), \
]
show(*profiles)#, hopperblock)
# %%
#ASSEMBLY
extruder = Compound(label="Extruder",children=[rodcollector.part,cylindercollector.part,nozzleplate.part,\
pumpcylinderblock.part,pumpcylinderrods.part,pumpcylinders.part,hopper.part])
extruder=Pos(120,170,168)*Rot(45,0,0)*extruder
#extruder.translate((hp/2,0,0))
show(*profiles,extruder)#, pumpcylindercutout)# %%
# %%
railpath = "/home/hbrs/Downloads/8381K54_Miniature Ball Bearing Carriage and Guide Rail.STEP"
carriagepath = "/home/hbrs/Downloads/6725K531_12 mm Wide x 200 mm Long Rail for Ball Bearing Carriage.STEP"
rail = import_step(railpath)
carriage = import_step(carriagepath)
show(carriage)
# %%
#cmpds = rail.compound()
shapes = rail.entities(topo_type=Part)
# %# %%
len(shapes)# %%
# %%
show(shapes[0])
# %%

106
water_blesser.py Normal file
View File

@ -0,0 +1,106 @@
#%%
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))
# %%