machine update

This commit is contained in:
Marius Unsel 2026-01-20 11:20:36 +01:00
parent 8367270bc0
commit be5dffa5c9
2 changed files with 265 additions and 85 deletions

35
balcony_hook2.py Normal file
View File

@ -0,0 +1,35 @@
import copy
from build123d import *
from ocp_vscode import show
ro = 70
wt=5
h = 100
with BuildPart() as part_builder:
with BuildSketch() as sk:
Circle(ro)
extrude(amount=h)
with Locations((0,ro, 20)):
Box(ro*2-20, 70, 40)
with Locations((0,25,0)):
Box(wt*2, 20, 50, mode=Mode.SUBTRACT)
with Locations((0,15,0)):
Box(ro*2-20-wt*4, wt*2, 60, mode=Mode.SUBTRACT)
with Locations((0,15+wt*3,-10)):
Box(ro*2-20-wt*4, wt*4, 20, mode=Mode.SUBTRACT)
with BuildSketch(part_builder.faces().sort_by(Axis.Z)[-1
]) as sk:
Circle(ro-wt)
extrude(amount=-(h-wt), mode=Mode.SUBTRACT)
fillet(part_builder.edges().group_by(Axis.Z)[-1], radius=wt/2-0.001)
show(part_builder)

313
drops.py
View File

@ -92,7 +92,7 @@ show(mold_for_mold)
# %% # %%
nHoles = 10 nHoles = 10
vol_ml = 0.3 # millilitiers = 1/1000 * 10cm*10cm*10cm = 100mm*100mm*100mm/1000 = 1000mm³ vol_ml = 1.0 # millilitiers = 1/1000 * 10cm*10cm*10cm = 100mm*100mm*100mm/1000 = 1000mm³
vol = vol_ml * 1000 vol = vol_ml * 1000
r = 4 # millimeters r = 4 # millimeters
ri = 2 ri = 2
@ -100,33 +100,69 @@ rrod=1
rodlen=100 rodlen=100
tol = 0.05 tol = 0.05
A = 3.14*r*r A = 3.14*r*r
t = vol/A # liter/meter t = 2*vol/A # liter/meter
wt = 1 wt = 1
l, w, h = (r+wt)*2, (r*2+wt)*(nHoles+0.5), t+4 l, w, h = (r*2+wt)*(nHoles+0.5)+8, t+8, (r+wt)*2
with BuildPart() as pumpcylindercutout: with BuildPart() as pumpcylindercutout:
with BuildSketch() as holes_sk: with BuildSketch(Plane.XZ) as holes_sk:
Circle(r) Circle(r)
extrude(amount=t) extrude(amount=t)
with BuildSketch(pumpcylindercutout.faces().sort_by(Axis.Z)[0]) as rodhole_sk: with BuildSketch(pumpcylindercutout.faces().sort_by(Axis.Y)[0]) as rodhole_sk:
Circle(rrod+tol) Circle(rrod+tol)
extrude(amount=10) extrude(amount=10)
chamfer(pumpcylindercutout.edges().sort_by(Axis.Z)[3],2) chamfer(pumpcylindercutout.edges().sort_by(Axis.Y)[3],2)
show(pumpcylindercutout) 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: with BuildPart() as oese:
c=Cylinder(3,2,rotation=(0,90,0)) c=Cylinder(3,2,rotation=(0,90,0))
fillet(c.edges().filter_by(GeomType.CIRCLE), 0.9) fillet(c.edges().filter_by(GeomType.CIRCLE), 0.9)
Cylinder(1.5,2,rotation=(0,90,0), mode=Mode.SUBTRACT) Cylinder(1.5,2,rotation=(0,90,0), mode=Mode.SUBTRACT)
show(oese) show(oese)
#%% #%%
with BuildPart() as pumpvalverod: with BuildPart() as pumpvalverod:
rodlen=100 rodlen=60
#Cylinder(3,4) #Cylinder(3,4)
#with Locations((0,0,rodlen/2-10)): #with Locations((0,0,rodlen/2-10)):
# Cylinder(rrod,rodlen) # Cylinder(rrod,rodlen)
with BuildSketch(Plane.YZ) as sk: with BuildSketch(Plane.XY) as sk:
with BuildLine() as outline: with BuildLine() as outline:
d=2 d=2
hn=1 hn=1
@ -138,45 +174,170 @@ with BuildPart() as pumpvalverod:
l6=CenterArc((0,rodlen),rrod,0,90) l6=CenterArc((0,rodlen),rrod,0,90)
l7=Line(l6@1,l1@0) l7=Line(l6@1,l1@0)
make_face() make_face()
revolve() revolve(axis=Axis.Y)
fillet(pumpvalverod.edges().sort_by(Axis.Z)[5],0.5) fillet(pumpvalverod.edges().sort_by(Axis.Y)[5],0.5)
with Locations((0,0,rodlen-3.5),(0,0,rodlen-11.5)): with Locations((0,rodlen-3,0),(0,rodlen-9,0)):
with Locations((-rrod,0,0),(rrod,0,0)): with Locations((-rrod,0,0),(rrod,0,0)):
Box(rrod,7,4, mode=Mode.SUBTRACT) Box(rrod,3,4, mode=Mode.SUBTRACT)
show(pumpvalverod) show(pumpvalverod)
# %% # %%
with BuildPart() as pumpcylinder: with BuildPart() as pumpcylinder:
rodlen=80 rodlen=50
Cylinder(r, rodlen) clen=8
with Locations((0,0,-rodlen/2+t/2)): elen=10
Cylinder(ri, t,mode=Mode.SUBTRACT) slen= 20
#chamfer(pumpcylinder.edges()[4],1) dy=-13
with Locations((0,0,t/2)): with BuildSketch(Plane.XZ.offset(dy)) as cl_sk:
Box(ri*2,r*2,rodlen-t,mode=Mode.SUBTRACT) Circle(r)
with Locations((0,0,-rodlen/2+t+1)): Circle(ri,mode=Mode.SUBTRACT)
Box(ri*2,r*3,r*3,rotation=(45,0,0), mode=Mode.SUBTRACT) extrude(amount=clen)
Box(ri*2,r*3,r*3, mode=Mode.SUBTRACT) chamfer(pumpcylinder.edges().group_by(Axis.Y)[0][1],1)
with Locations((0,-ri-1,-2),(0,ri+1,-2)): with BuildSketch(pumpcylinder.faces().sort_by(Axis.Y)[-1]) as rods_sk:
Box(r*2,ri+2,rodlen-t-4,mode=Mode.SUBTRACT) with PolarLocations(r-(r-ri)/2,3,90):
#s=pumpcylinder.edges().group_by(Axis.Z)[2] Circle((r-ri)/2)
#filter_by(GeomType.CIRCLE,reverse=True)#.filter_by(Axis.X.is_parallel) extrude(amount=slen)
#fillet( s[0:2],1) with BuildSketch(Plane.XZ.offset(dy-slen-clen)) as cl_sk:
chamfer(pumpcylinder.edges().group_by(Axis.Z)[0][1],1) 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)
show(pumpcylinder)
#%%
with BuildPart() as pumpcylinderblock:
Box(l,w,h)
f = pumpcylinderblock.faces()[5].offset(-t)
#with GridLocations()
with Locations((0,0,h/2-t)):
with GridLocations(0,r+wt+r,1,nHoles):
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))
show(pumpcylinderblock)
#%% #%%
# 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: with BuildPart() as stand:
ws = 120 ws = 120
wsx=60 wsx=60
@ -207,48 +368,12 @@ with BuildPart() as standfoot:
#extrude(amount=4) #extrude(amount=4)
#offset(amount=-1.9, openings=[stand.faces().sort_by(Axis.Z)[-1]]) #offset(amount=-1.9, openings=[stand.faces().sort_by(Axis.Z)[-1]])
show(standfoot) show(standfoot)
#%%
with BuildPart() as pumpcylinderrods:
with Locations((0,0,h/2-t-2-rrod)):
with GridLocations(0,r+wt+r,1,nHoles):
add(copy.copy(pumpvalverod))
with BuildPart() as pumpcylinders:
with Locations((0,0,h/2-t+rodlen/2)):
with GridLocations(0,r+wt+r,1,nHoles):
add(copy.copy(pumpcylinder),rotation=(0,0,90))
LinearJoint("cylinders", axis=Axis.Z, linear_range=(-t, t))
pumpcylinderblock.part.joints["slide"].connect_to(pumpcylinders.joints["cylinders"])
show(pumpcylinderblock,stand,pumpcylinderrods,pumpcylinders,render_joints=True)#, pumpcylindercutout)# %%
# %% # %%
pumpcylinder.edges().group_by(Axis.Z)[1] #export_step(hopperblock, "machineparts/hopperblock.step")
# %% #export_step(stand.part, "machineparts/stand.step")
with BuildPart() as hopper: #export_step(standfoot.part, "machineparts/standfoot.step")
with BuildSketch(Plane.XY.offset(h/2)) as down_sk: #export_step(pumpvalverod.part, "machineparts/valverod.step")
RectangleRounded(l,w,4) #export_step(pumpcylinder.part, "machineparts/pumpcylinder.step")
with BuildSketch(Plane.XY.offset(60)) as up_sk:
with Locations((20,0)):
RectangleRounded(l+50,w+50, 8)
loft()
offset(amount=-0.5, openings=[hopper.faces().sort_by(Axis.Z)[0],\
hopper.faces().sort_by(Axis.Z)[-1]])
#show(hopper)
show(pumpcylinderblock,pumpcylinderrods,pumpcylinders,hopper,render_joints=True)#, pumpcylindercutout)# %%
# %%
show(hopper,hopper.faces().sort_by(Axis.Z)[-1])
# %%
hopperblock = pumpcylinderblock.part + hopper.part
show(hopperblock)
# %%
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: with BuildPart() as idb_holder:
Box(24,46,8) Box(24,46,8)
@ -260,8 +385,6 @@ with BuildPart() as idb_holder:
fillet(idb_holder.edges().group_by(Axis.Z)[-1].filter_by(GeomType.LINE)[0], radius=1.5) fillet(idb_holder.edges().group_by(Axis.Z)[-1].filter_by(GeomType.LINE)[0], radius=1.5)
show(idb_holder) show(idb_holder)
# %% # %%
show(idb_holder, idb_holder.edges().group_by(Axis.Z)[-1].filter_by(GeomType.LINE)[0])
# %%
export_step(idb_holder.part, "idb_holder.step") export_step(idb_holder.part, "idb_holder.step")
# %% # %%
@ -300,5 +423,27 @@ profiles= [ \
] ]
show(*profiles)#, hopperblock) 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])
# %%