Download or view VoxelSolidOfRotation.frink in plain text format
/** This tests extruding an image or text as a solid of rotation for 3-D
printing. The resulting objects work nicely as nameplates or chopstick
rests. This version fixes the problem with letters with descenders.
*/
string = "Alan"
// Render text as a bitmap
g = new graphics
g.font["SansSerif", "bold", 1]
g.text[string, 0, 0]
img = new image[g, 800, undef].autocrop[]
// Extrude the bitmap as a one-voxel-thick layer.
v = callJava["frink.graphics.VoxelArray", "extrudeZ", [img,1]]
// Make a solid of rotation around the base of the characters.
v = v.solidOfRotation[0, v.getMinY[], 0, 1, 0, 0, 0 deg, 70 deg]
// Make a base
minX = v.getMinX[]
maxX = v.getMaxX[]
minY = v.getMinY[]
maxY = v.getMaxY[]
minZ = v.getMinZ[]
maxZ = v.getMaxZ[]
base = callJava["frink.graphics.VoxelArray", "construct", [minX, maxX, minY, maxY, minZ-15, minZ, true]]
v = v.union[base]
v.projectX[undef].show["X"]
v.projectY[undef].show["Y"]
v.projectZ[undef].show["Z"]
filename = "$string.obj"
print["Writing $filename..."]
w = new Writer[filename]
w.println[v.toObjFormat[string]]
w.close[]
println["done."]
Download or view VoxelSolidOfRotation.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 20203 days, 11 hours, 5 minutes ago.