Download or view airfoilExtrudeTestNew.frink in plain text format
/** This extrudes a 3-D version of an airfoil using the airfoil.frink program
for use in 3-D printing. This version creates an extruded *and* tapered
*and) rotated airfoil.
*/
use airfoil.frink
r = 254/in
id = "naca4424"
a = Airfoil.loadSelig["file:/home/eliasen/builds/airfoils/$id.dat"]
rootAngle = 20 deg
tipAngle = 40 deg
//b = a.rotate[35 deg]
//p = b.toFilledPolygon[]
p = a.toFilledPolygon[]
p.show[]
pl = p.toPoint2DFloatList[-300, 300] // Airfoil normally faces left; let's face it right
[cx, cy] = pl.getCentroid[].toExpression[]
println["Centroid is $cx, $cy"]
v = callJava["frink.graphics.VoxelArray", "extrudeTaperedRotated", [pl, 0,0,0, 0,0, 4.5 in r,cx,cy, 0.5, 1, rootAngle, tipAngle]]
v1 = callJava["frink.graphics.VoxelArray", "extrudeTaperedRotated", [pl, 0,0,0, 0,0,-4.5 in r,cx,cy, 0.5, 1, rootAngle, tipAngle]]
v1.translate[278,0,0]
v = v.union[v1]
hubHeight = .3 cm
hubRadius = .8 cm
hub = callJava["frink.graphics.VoxelArray", "makeCylinder", [278/2, (hubHeight + 0 mm) r, 0, 278/2, (-hubHeight/2 - 3 mm) r, 0, hubRadius r]]
v = v.union[hub]
shaftRadius = 4.1 mm/2
shaft = callJava["frink.graphics.VoxelArray", "makeCylinder", [278/2, 2 hubHeight r, 0, 278/2, -2 hubHeight r, 0, shaftRadius r]]
v.remove[shaft]
v.projectX[undef].show["X"]
v.projectY[undef].show["Y"]
v.projectZ[undef].show["Z"]
filename = "airfoil$id.obj"
print["Writing $filename..."]
w = new Writer[filename]
w.println[v.toObjFormat["airfoil$id", 1/(r mm)]]
w.close[]
println["done."]
Download or view airfoilExtrudeTestNew.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 20136 days, 3 hours, 50 minutes ago.