cap3D.frink

View or download cap3D.frink in plain text format


/** This makes a 3-D model for a  cylindrical cap for various objects. */

// The resolution of the object in voxels/length.
r = 254/in

// Configure these for your cap.  Note that your slicer software may force
// minimum wall thicknesses that override these.
innerDiam = 40.0 mm
sidewallThickness = 1.5 mm
outerDiam = innerDiam + 2 sidewallThickness
height = 60 mm
topThickness = 2 mm

// Outer main cylinder
c1 = callJava["frink.graphics.VoxelArray", "makeCylinder", [0, 0, 0, 0, 0, height r, outerDiam/2 r]]

// Inner main cylinder.  Remove it from outer cylinder.
cin = callJava["frink.graphics.VoxelArray", "makeCylinder", [0, 0, topThickness r, 0, 0, height r, innerDiam/2 r]]
c1.remove[cin]

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

filename = "cap.obj"
print["Writing $filename..."]
w = new Writer[filename]
w.println[c1.toObjFormat["test", 1/(r mm)]]
w.close[]
println["done."]


View or download cap3D.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 19093 days, 18 hours, 51 minutes ago.