extrudeTest.frink

Download or view extrudeTest.frink in plain text format


/** This tests extruding an image or text to a 3-D VoxelArray for 3-D
    printing. */


g = new graphics
g.font["SansSerif", "bold", 1]
g.text["Alan", 0, 0]
img = new image[g, 800, 800].autocrop[]
//img.show[]

v = callJava["frink.graphics.VoxelArray", "extrudeZ", [img,20]]

//println["Max x is " + v.getMaxX[]]
println["Max z is " + v.getMaxZ[]]

// Rotate it up around its bottom
v = v.rotate[v.getMaxX[], 0, 0, 1, 0, 0, 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, minZ+10, true]]

v = v.union[base]

v.projectX[undef].show["X"]
v.projectY[undef].show["Y"]
v.projectZ[undef].show["Z"]

filename = "extrudeTest.obj"
print["Writing $filename..."]
w = new Writer[filename]
w.println[v.toObjFormat["extrude"]]
w.close[]
println["done."]




Download or view extrudeTest.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 19305 days, 18 hours, 10 minutes ago.