chopsticks.frink

Download or view chopsticks.frink in plain text format


/** This program makes chopsticks with polygonal sides for 3-D printing.  A
    Japanese TV show said that 5-sided or 7-sided chopsticks were more
    comfortable in the hand.  This basiclaly tests the extrusion of a tapered
    polygon for 3D printing.
*/


polygon = newJava["frink.graphics.Point2DFloatList"]

sides = 5
sideAngle = circle/sides
angle = 90 deg  // Point at top

outerRadius = 9 mm / 2
tipRadius = 3.4 mm / 2
length = 9 in

res = 254/in

for i = 1 to sides
{
   x = outerRadius cos[angle] res
   y = outerRadius sin[angle] res
   polygon.addPoint[x,y]
   angle = angle + sideAngle
}

v = callJava["frink.graphics.VoxelArray", "extrudeZTapered", [polygon, 0 in res, length res, outerRadius/outerRadius, tipRadius/outerRadius]]

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

filename = "Chopsticks${sides}x" + format[length, in, 1] + "od" + format[2 outerRadius, mm, 1] + "id" + format[2 tipRadius, mm, 1] + ".obj"
print["Writing $filename..."]
w = new Writer[filename]
w.println[v.toObjFormat["chopsticks", 1/(res mm)]]
w.close[]
println["done."]


Download or view chopsticks.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 19966 days, 7 hours, 20 minutes ago.