discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Scripted image generation?

JA
Jeremy Ardley
Tue, Apr 26, 2022 9:36 AM

In my case I want to generate many images of O-Rings of varying sizes.

I can do this with a very simple stanza of code with parameters for
thickness and internal diameter

inside_diameter= 1.07;
oring_width=1.27;
$fn=200;
color("#505050"){
    rotate_extrude(){
        translate([(inside_diameter+oring_width), 0]){
            circle(oring_width);
            }
        }
    }

I then export the image each time I run it with different parameters

I would like to automate this process so I can feed in a list of
diameters and thicknesses and get multiple PNG files as output.

Is there any way to do this?

As a secondary issue, I set the color to be used in my script and it
works in preview, but in render I only get one of a few possible
variants selected via the menu,

I would like to be able to force render to use the color value of my
script. Is this possible?

Finally, the lighting used is diffuse. It would be good to be able to
specify an origin and distance of the light source, and perhaps further,
specify a color or spectrum to use

--
Jeremy

In my case I want to generate many images of O-Rings of varying sizes. I can do this with a very simple stanza of code with parameters for thickness and internal diameter inside_diameter= 1.07; oring_width=1.27; $fn=200; color("#505050"){     rotate_extrude(){         translate([(inside_diameter+oring_width), 0]){             circle(oring_width);             }         }     } I then export the image each time I run it with different parameters I would like to automate this process so I can feed in a list of diameters and thicknesses and get multiple PNG files as output. Is there any way to do this? As a secondary issue, I set the color to be used in my script and it works in preview, but in render I only get one of a few possible variants selected via the menu, I would like to be able to force render to use the color value of my script. Is this possible? Finally, the lighting used is diffuse. It would be good to be able to specify an origin and distance of the light source, and perhaps further, specify a color or spectrum to use -- Jeremy