VacuumNozzle.frink

Download or view VacuumNozzle.frink in plain text format


/** This makes a long narrow nozzle for 3-D printing that attches to  a
    canister vacuum hose.  The nozzle is intended to be skinny enough to
    fit between refrigerator coil gaps and vacuum out narrow spaces like
    CPU cooling fan vanes and gaps between keys in keyboards.

    Currently, the wall thicknesses are intended to be multiples of 1.2 mm which
    is 3 thicknesses of an 0.4 mm nozzle.
*/


res = 254/in

baseRadius = 32 mm / 2
baseHeight = 32 mm
baseThickness = 2.4 mm

taperLength = 1 inch

// Max height of Ender 3 Pro is 250 mm.  Make this slightly shorter.
maxHeight = 240 mm
nozzleOuterX = 6.1 mm
nozzleOuterY = 25.4 mm
nozzleThickness = 1.2 mm
nozzleInnerX = (nozzleOuterX - (nozzleThickness*2))
nozzleInnerY = (nozzleOuterY - (nozzleThickness*2))

// Calculate the velocity ratio due to the taper
velocityRatio = pi baseRadius^2 / (nozzleInnerX * nozzleInnerY)
println["Velocity ratio is " + formatFix[velocityRatio,1,2]]

// Base "adapter" cylinder that connects to the vacuum hose.
baseOuter = callJava["frink.graphics.VoxelArray", "makeCylinder", [0,0,0,0,0,baseHeight res, (baseRadius+baseThickness) res]]
baseInner = callJava["frink.graphics.VoxelArray", "makeCylinder", [0,0,0,0,0,baseHeight res, (baseRadius) res]]

// Taper part.  This is a cone that will later be pierced by the nozzle so
// it can be closed.
taperOuter = callJava["frink.graphics.VoxelArray", "makeTaperedCylinder", [0,0,baseHeight res,0,0,(baseHeight+taperLength) res, (baseRadius+baseThickness) res, baseThickness res]]
taperInner = callJava["frink.graphics.VoxelArray", "makeTaperedCylinder", [0,0,baseHeight res,0,0,(baseHeight+taperLength) res, baseRadius res, 0]]

v = baseOuter.union[taperOuter]

// Nozzle part.  This is an open rectangle that pierces the base and taper.
top = maxHeight
bottom = baseHeight
nozzleOuter = callJava["frink.graphics.VoxelArray", "construct", [(-nozzleOuterX/2) res, (nozzleOuterX/2) res, (-nozzleOuterY/2) res, (nozzleOuterY/2) res, bottom res,top res,true]]
nozzleInner = callJava["frink.graphics.VoxelArray", "construct", [(-nozzleInnerX/2) res, (nozzleInnerX/2) res, (-nozzleInnerY/2) res, (nozzleInnerY/2) res, bottom res,top res,true]]

v = v.union[nozzleOuter]

// Now we remove all the inner parts last so we're certain to have a hollow
// channel even if the other surfaces overlap.
v.remove[baseInner]
v.remove[taperInner]
v.remove[nozzleInner]

v.projectX[undef].show["X"]
v.projectY[undef].show["Y"]
v.projectZ[undef].show["Z"]

filename = "VacuumNozzle.obj"
print["Writing $filename..."]
w = new Writer[filename]
w.println[v.toObjFormat["nozzle", 1/(res mm)]]
w.close[]
println["done."]


Download or view VacuumNozzle.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 19944 days, 8 hours, 15 minutes ago.