POV-Ray : Newsgroups : povray.general : Standard machine screw threads, via f_helix1 isosurface : Re: Standard machine screw threads, via f_helix1 isosurface Server Time
2 Dec 2023 12:59:37 EST (-0500)
  Re: Standard machine screw threads, via f_helix1 isosurface  
From: Bald Eagle
Date: 8 Jun 2019 10:45:00
Message: <web.5cfbc9adb373d57c4eec112d0@news.povray.org>
Thanks Robert!  :)

I always appreciate some simple detailed scenes that work out some of the
details of shapes that are challenging to quickly figure out from the
documentation.  Often we only have the newsgroups to really give a clear

Being short and simple, it makes for a great little scene to dabble with while
having morning coffee.

That said, I've already "broken POV-Ray" and triggered an error I've not yet
seen or even been aware of.

"light source must be defined using new syntax"
No idea when "new" referred to, but this thread is from 2006:

Who knew?  I'd sure like more info on that.

So here I am not even through coffee #1, and I've already learned something.  ;)

> 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).

You may want to do something like:
// scene scale
#declare MM = 1;
#declare Inch = 25.4 * MM;
#declare Unit = Inch; // this carries through whole scene

Then you can just (edit|replace) all instances of 25.4 with Unit.
Otherwise you have to hunt for all instances of 25.4, and I always miss at least
ONE  ;)

> #local D_maj = (4 * 13/1000 + 3/50) * 25.4;

13/1000, 3/50 ... These are "magic numbers" - what do they mean?

>         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)

Same here - sqrt (3/4)?  sqrt (147/256)? :O   sqrt (1/3)?

>     cylinder { Y_min * y, Y_max * y, D_maj / 2 - sqrt (75/256) / Density }

sqrt (75/256)?  :O

 #local Size = 4;  // <--- makes it easier to see what to change
 #local D_maj = (Size * 13/1000 + 3/50) * Unit; // M or # of thread diameter

Rotating screw z*90 makes it easier (for me) to see your thread profile - mostly
due to the reflection of the Aluminum texture.

I don't know what you're using this for (hopefully a larger scene will be
forthcoming ;)  )  but maybe you might consider putting together a little
database of common screw sizes / threads.

Then maybe make a hex nut and difference out the screw.  :)

I'm thinking either use an array, and do something like

ScrewArray [2] = { blah blah isosurface parameters}

#declare M3_05 = 0;
#declare Num4_40 = 1;
and then you can
#declare ScrewType = Num4_40;  // then use this to get ScrewArray [ScrewType]

and other scene  bits can be controlled by
#switch (ScrewType)
     #case (0)
          // M3_05 specific scene stuff here

     #case (0)
          // M3_05 specific scene stuff here

     #debug "Invalid Screw Type specified."

It would be a nice little include file.

Post a reply to this message

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