POV-Ray : Newsgroups : povray.general : Standard machine screw threads, via f_helix1 isosurface : Re: Standard machine screw threads, via f_helix1 isosurface Server Time
29 Apr 2024 10:21:32 EDT (-0400)
  Re: Standard machine screw threads, via f_helix1 isosurface  
From: Mark
Date: 11 Sep 2023 08:25:00
Message: <web.64ff068eb373d57cf00fef66b571e5b2@news.povray.org>
Robert Munyer <917### [at] munyercom> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.