Download or view cylindricalEmbossGrayTest.frink in plain text format
/** This is a test of cylindrical embossing for 3-D printing. */
res = 254/inch
h = 1 inch
r = .5 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 res, r res,
-r res, r res,
-h/2 res, h/2 res, true]]
// Create a graphic from text
/*
g = new graphics
g.font["SansSerif", "bold", 10]
g.text["Frink Rules!",0,0]
img = g.toImage[undef, 200]
img.show[]
img.write["FrinkRules.png"]
*/
// Or load an image. This one is blurred to give depth.
img = new image["https://frinklang.org/frinksamp/FrinkRules.png"]
//img = new image["file:FrinkRules.png"]
// 2-pixel cube tool for testing
pixelTool = newJava["frink.graphics.VoxelArray", [0,2,0,2,0,2,true]]
emboss = v.cylindricalEmboss[img, 0,0,0, 180 deg, 360 deg, 1 inch res, 0, 192, 0 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 = "cylindricalEmbossGray.obj"
print["Writing $filename..."]
w = new Writer[filename]
w.println[v.toObjFormat["v", 1/(res mm)]]
w.close[]
println["done."]
Download or view cylindricalEmbossGrayTest.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, 6 hours, 37 minutes ago.