Download or view ArmillarySphere.frink in plain text format
/** This makes an armillary sphere for 3-D printing. */
res = 254/in
ringHeight = 1 cm
ringOuterRadius = 3.5 in / 2
ringThickness = 2.4 mm
ring = callJava["frink.graphics.VoxelArray", "makeCylinder", [0, 0, 0, 0, 0, ringHeight res, ringOuterRadius res]]
ring2 = callJava["frink.graphics.VoxelArray", "makeCylinder", [0, 0, 0, 0, 0, ringHeight res, (ringOuterRadius-ringThickness) res]]
ring.remove[ring2]
tickHeight = 1.2 mm
tickRadius = .3 mm
textDepth = ringThickness/2
for angle = 0 to 350 step 10
{
g = new graphics
g.font["SansSerif", "bold", 1]
g.text[angle, 0, 0]
img = new image[g, undef, round[.4 ringHeight res]]
x = ringOuterRadius cos[-angle deg]
y = ringOuterRadius sin[-angle deg]
text = callJava["frink.graphics.VoxelArray", "extrudeZ", [img, round[-textDepth res], round[textDepth res]]]
text = text.rotateXYZ[0,0,0, 90 deg, 90 deg, (-angle + 90) deg]
text.translate[round[x res], round[y res], round[ringHeight/2 res]]
ring.remove[text]
// Make ticks
tick = callJava["frink.graphics.VoxelArray", "makeCappedCylinder", [x res, y res, ringHeight res, x res, y res, (ringHeight-tickHeight) res, tickRadius res]]
ring.remove[tick]
tick = callJava["frink.graphics.VoxelArray", "makeCappedCylinder", [x res, y res, 0, x res, y res, tickHeight res, tickRadius res]]
ring.remove[tick]
}
v = ring
v.projectX[undef].show["X"]
v.projectY[undef].show["Y"]
v.projectZ[undef].show["Z"]
filename = "ArmillarySphere.obj"
print["Writing $filename..."]
w = new Writer[filename]
w.println[v.toObjFormat["armillary", 1/(res mm)]]
w.close[]
println["done."]
Download or view ArmillarySphere.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, 13 hours, 11 minutes ago.