|
 |
Robert Munyer <917### [at] munyer com> wrote:
> I figured out how to get f_helix1 to produce the "basic profile" shape
> used by standard machine screw threads, both American and metric.
>
> Getting a specific desired shape from f_helix1 is not straightforward,
> so I'm posting my code here for the benefit of anyone else who may
> want to model this shape.
>
> The scene file below will produce 1/4 inch of #4-40 thread, aligned
> with the Y axis, in a scene measured in millimeters. For a scene
> measured in some other unit, change the number 25.4 everywhere it
> appears. For M3-0.5 thread instead of #4-40, change D_maj to 3 and
> change Density to 2 (the "0.5" means 2 turns per millimeter).
>
> #version 3.7;
> #include "colors.inc"
> #include "functions.inc"
> #include "textures.inc"
> global_settings { assumed_gamma 1 }
> object {
>
>
>
> #local D_maj = (4 * 13/1000 + 3/50) * 25.4;
> #local Density = 40 / 25.4;
> #local Y_min = 0 * 25.4;
> #local Y_max = 1/4 * 25.4;
> #local Max_gradient = 3;
>
> intersection {
> union {
> isosurface {
> function {
> f_helix1 (x, y, - z, 1, Density * 2 * pi, sqrt (3/4) / Density,
> D_maj / 2 - sqrt (147/256) / Density, sqrt (1/3), 2, 0)
> }
> contained_by {
> box { <- D_maj / 2, Y_min, - D_maj / 2>, <D_maj / 2, Y_max, D_maj / 2> }
> }
> max_gradient Max_gradient
> all_intersections
> }
> cylinder { Y_min * y, Y_max * y, D_maj / 2 - sqrt (75/256) / Density }
> }
> cylinder { Y_min * y, Y_max * y, D_maj / 2 }
> }
>
>
>
> texture { Aluminum }
> }
> plane { y, 0 pigment { color Green } }
> light_source { <2, 4, -3> * 25.4 color White }
> camera { location <0, 1/8, -3/8> * 25.4 look_at <0, 1/8, 0> * 25.4 }
This is excellent. Thanks.
Post a reply to this message
|
 |