Download or view planarEmbossTest.frink in plain text format
/** This is a test of planar embossing for 3-D printing. */
res = 254/inch
h = 1 inch
r = 2 inch
// Test on a cylinder
//v = callJava["frink.graphics.VoxelArray", "makeCylinder", [0,0,h/2 res,0,0,-h/2 res, r res]]
// Test on a cuboid
/*
v = callJava["frink.graphics.VoxelArray", "cube", [-r/2 res, r/2 res,
-r/2 res, r/2 res,
-h/2 res, h/2 res, true]]
*/
// Or a sphere
v = callJava["frink.graphics.VoxelArray", "makeSphere", [r/2 res]]
// Create a graphics from text
/*
g = new graphics
g.font["SansSerif", "bold", 10]
g.text["Frink Rules!",0,0]
img = g.toImage[undef, 200]
img.show[]
*/
// Or load an image
img = new image["https://frinklang.org/frinksamp/FrinkRules.png"]
// 2-pixel cube tool for testing
pixelTool = newJava["frink.graphics.VoxelArray", [0,2,0,2,0,2,true]]
emboss = v.planarEmboss[img, 0,0, r res, r res, 0, 200, .2 cm res, 0 cm res, -.2 cm res, 0 cm res, pixelTool, 0, 0, 0]
//v.remove[emboss]
// Test removal
v = v.union[emboss] // Test addition
//v = emboss
// Just show embossing.
v.projectX[undef].show["X"]
v.projectY[undef].show["Y"]
v.projectZ[undef].show["Z"]
filename = "planarEmboss.obj"
print["Writing $filename..."]
w = new Writer[filename]
w.println[v.toObjFormat["v", 1/(res mm)]]
w.close[]
println["done."]
Download or view planarEmbossTest.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 20162 days, 22 hours, 34 minutes ago.