embossBirdcage.frink

Download or view embossBirdcage.frink in plain text format


/** This renders a birdcage with an embossed pattern on it for 3-D printing.
*/


use Plot3D.frink

p = new Plot3D[]

res = 254/in

img = new image["file:spiraleggblack.bmp"]
img = img.gaussianBlur[10]
img.show[]


radius = 1.5 in res
height = 3 in res
v = callJava["frink.graphics.VoxelArray", "construct", [-radius, radius, -radius, radius, 0 in res, height, false]]
v.drawCappedCylinder[0,0,0,0,0,height-radius,radius]

pixelTool = newJava["frink.graphics.VoxelArray", [0,2,0,2,0,2,true]]

min = v.getMinimumSetPoints[]
max = v.getMaximumSetPoints[]
cx = (min.x + max.x) div 2
cy = (min.y + max.y) div 2
cz = (min.z + max.z) div 2

println["Minimum set points: " + min.toString[]]
println["Maximum set points: " + max.toString[]]
println["cx=$cx, cy=$cy, cz=$cz"]
cz = 2/3 cz

depth = 2 mm res
vangle = 180 deg
vcenter = 32.5 deg
emboss = v.sphericalEmboss[img, cx, cy, cz, 180 deg, 360 deg, vcenter, 180 deg - vcenter, 0, 175, depth, 0 mm res, -depth, 0 mm res, pixelTool, 0, 0, 0]

//v.remove[emboss]
p.show[emboss]
p.writeObj[emboss,"embossBirdcage"]


Download or view embossBirdcage.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, eliasen@mindspring.com