TelescopeViewfinder2.frink

Download or view TelescopeViewfinder2.frink in plain text format


/** This renders a 3-D model to fix my telescope viewfinder to Wavefront .obj
    file format for 3-D printing.

    This is a second attempt using constructive solid geometry in Frink.  The
    first attempt is in TelescopeViewFinder.frink

    See: http://paulbourke.net/dataformats/obj/
*/


stopDiam = 1.25 in
cylDiam = 1.195 in
b = .6757 in    // Distance from end of pipe to center of mirror holder

z0 = 0 mm
z1 = -2 mm
r = 300/in     // This is the resolution of the model.  All dimensioned
               // measurements are multiplied by this to get dimensionless
               // numbers to feed to the dimensionless integer VoxelArray class

// Stopper
v = callJava["frink.graphics.VoxelArray", "makeCylinder", [0,0,z0 r, 0,0,z1 r, stopDiam/2 r]]

// Main cylinder
v = v.union[callJava["frink.graphics.VoxelArray", "makeCylinder", [0,0,z0 r, 0,0,2 in r, cylDiam/2 r]]]

// Cut a face from the main cylinder
plane = newJava["frink.graphics.Plane3DFloat", [0,0, b r, -1, 0, 1]]
v.removeOutside[plane]

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

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


Download or view TelescopeViewfinder2.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 20051 days, 21 hours, 49 minutes ago.