Drawing a field of stars (or other objects) using Python/OpenSCAD

As with most of my projects, we start out by roughing things out in BlockSCAD, so first we set up some variables which will be instantiated in the Customizer in OpenSCAD:

(obviously, the intention is to make it possible to create the field of a U.S. Flag)

For the default parameter of stars, we will use the pointier version which is suited to 3D modeling:

which suggests an additional variable (or two):

First, we create modules for drawing the various objects, starting with the star which requires a bit of trigonometry…

1 Like

and

(with a negative version as well)

which yields one point of the star — adding a loop and rotating we get:

1 Like

Obviously a few additional variables will be needed for spacing, and then a pair of nested loops to do the positioning:

A quick initial version without implementing “Stagger” yields:

Probably there is an elegant logical way to implement that feature, but a brute-force approach is to use a pair of loops, each set to step by 2:

so, a simple logic check and two versions:

and when Stagger is off we get:

3 Likes

Bailed on the (or other objects) bit, renamed the project and put it up at:

for folks who are curious about the code.

Next up is re-writing it in Python.

1 Like

This is very interesting. Please keep exploring & sharing.

BlocksCAD - open source?

Code should be at:

1 Like