Download or view airfoilPoster.frink in plain text format
/** This plots a poster or chart of various airfoils.
All of the airfoils can be downloaded from:
https://m-selig.ae.illinois.edu/ads/archives/coord_seligFmt.zip
Usage:
frink airfoilPoster.frink [filenames]
This program is most easily run from the directory where the airfoils are
extracted. If no filenames are specified, this will render all .dat files
in the current directory:
frink airfoilPoster.frink
If airfoil filenames are specified, this will render the specified airfoils
which can be in a different directory. Most generally, the command-line
below will render the airfoils n*.dat. MAKE SURE TO ADJUST ALL PATHS TO
MATCH YOUR SYSTEM!
/path/to/frink /path/to/airfoilPoster.frink /path/to/airfoils/n*.dat
*/
use airfoil.frink
// The width indicates how many airfoils per column.
//width = floor[sqrt[length[ARGS]]]
// This gives a square poster
width = 8 // Good for SVG chart
scale = 100
if length[ARGS] == 0
{
println["No filenames specified. Will render all .dat files in the current directory."]
filenames = new array
for f = select[files["."], {|file| file.getName[] =~ %r/\.dat$/i}]
filenames.push[f.getName[]]
} else
filenames = deepCopy[ARGS]
lexicalSort[filenames]
poster = new graphics
cell = 0
for filename = filenames
{
url = filenameToURL[filename]
println[url]
airfoil = Airfoil.loadSelig[url]
poly = airfoil.toFilledPolygon[scale, scale]
caption = new graphics
caption.font["SansSerif", 5]
name = airfoil.name
name =~ %s/\s+airfoil\b//i // Remove word "AIRFOIL"
name =~ %s/(.{7,}?)\s\(/$1\n\(/i // Split before first parentheses
name =~ %s/(.{12,}?)\s/$1\n/g // Split lines
caption.text[name, scale/2, .3 scale]
poster.addCenter[poly, cell mod width, cell div width, .9, .9]
poster.addCenter[caption, cell mod width, (cell div width) + .3, .9, .9]
cell = cell + 1
}
println["$cell airfoils processed."]
//poster.show[]
poster.write["airfoils.svg", 1000, undef, .995]
println["airfoils.svg written."]
poster.write["airfoils.html", 1000, undef, .995]
println["airfoils.html written."]
Download or view airfoilPoster.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 20145 days, 18 hours, 32 minutes ago.