Download or view parametric3DTest.frink in plain text format
/** This tests the routines in parametric3D.frink for making objects for 3-D
printing. */
use parametric3D.frink
/** Sample rendering code of screw threads. */
res = 254/in
// Single-pixel tool for testing
pixelTool = newJava["frink.graphics.VoxelArray", [0,1,0,1,0,1,true]]
// Spherical tool
sphereTool = callJava["frink.graphics.VoxelArray", "makeSphere", [.025 in res]]
// Double-cone tool
th = .025 in
tr = .025 in
t1 = callJava["frink.graphics.VoxelArray", "makeTaperedCylinder", [0,0,0,0,0,th res, tr res, 0]]
t2 = callJava["frink.graphics.VoxelArray", "makeTaperedCylinder", [0,0,0,0,0,-th res, tr res, 0]]
doubleConeTool = t1.union[t2]
// Double-cone with flat sides tool
th = .025 in
tr = .025 in
flatHeight = .025 in
t1 = callJava["frink.graphics.VoxelArray", "makeTaperedCylinder", [0,0,flatHeight/2 res,0,0,(th+flatHeight/2) res, tr res, 0]]
t2 = callJava["frink.graphics.VoxelArray", "makeTaperedCylinder", [0,0,-flatHeight/2 res,0,0,-(th + flatHeight/2) res, tr res, 0]]
flat = callJava["frink.graphics.VoxelArray", "makeCylinder", [0,0,flatHeight/2 res,0,0,-flatHeight/2 res, tr res]]
doubleConeWithFlatSidesTool = t1.union[t2].union[flat]
f = getFunction["helix",2]
p = calculatePath[f, [.5 inch, .075 inch, 0 deg], 0, 20 pi, res]
//p = calculatePath[getFunction["MobiusStrip",2], [.5 inch, .075 inch], 0, 20 pi, res]
println[p.getPointCount[]]
v = callJava["frink.graphics.VoxelArray", "paintAlongPath", [p, doubleConeWithFlatSidesTool, 0,0,0]]
v.projectX[undef].show["X"]
v.projectY[undef].show["Y"]
v.projectZ[undef].show["Z"]
filename = "helix.obj"
print["Writing $filename..."]
w = new Writer[filename]
w.println[v.toObjFormat["helix", 1/(res mm)]]
w.close[]
println["done."]
Download or view parametric3DTest.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 20139 days, 6 hours, 44 minutes ago.