airfoilExtrudeTest.frink

Download or view airfoilExtrudeTest.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.
*/


use airfoil.frink

r = 254/in
    
id = "naca4424"
a = Airfoil.loadSelig["file:/home/eliasen/builds/airfoils/$id.dat"]
    
b = a.rotate[35 deg]
p = b.toFilledPolygon[]
p.show[]
pl = p.toPoint2DFloatList[300, 300]
[cx, cy] = pl.getCentroid[].toExpression[]
println["Centroid is $cx, $cy"]
v = callJava["frink.graphics.VoxelArray", "extrudeTapered", [pl, 0,0,0, 0,0,3 in r,cx,cy, 0.5, 1, 180 deg]]
v1 = callJava["frink.graphics.VoxelArray", "extrudeTapered", [pl, 0,0,0, 0,0,-3 in r,cx,cy, 0.5, 1, 180 deg]]
v1.translate[280,0,0]
v = v.union[v1]

hubHeight = .3 cm
hubRadius = .8 cm    
hub =  callJava["frink.graphics.VoxelArray", "makeCylinder", [280/2, (hubHeight  + 1.4 mm) r, 0, 280/2, (-hubHeight/2 - 3 mm) r, 0, hubRadius r]]

v = v.union[hub]    
shaftRadius = 4.1 mm/2    
shaft = callJava["frink.graphics.VoxelArray", "makeCylinder", [280/2, 2 hubHeight r, 0, 280/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 airfoilExtrudeTest.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 19973 days, 8 hours, 22 minutes ago.