Snowflake growth simulation in BlocksCAD

by arpruss, published

Snowflake growth simulation in BlocksCAD by arpruss Dec 31, 2017
0 Share
Download All Files

Thing Apps Enabled

Open in Customizer Order This Printed View All Apps


Design Tools


A part of these Groups

View All

Liked By

View All

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag

Thing Statistics

816Views 309Downloads Found in Math Art


This implements a modification of Reiter's hex cell snowflake growth algorithm in BlocksCAD. The algorithm uses a real-valued cellular automaton modeling the diffusion and accretion of moisture. When run at high resolution, the model can produce surprisingly lifelike snowflakes, but BlocksCAD can't handle more than about radius 50 (and even that is laggy) of hex grid for the evolution.

I strongly recommend using Firefox instead of Chrome for these large BlocksCAD projects. Firefox is much more responsive.

The model has these main parameters:

  • alpha: controls moisture diffusion speed
  • beta: controls background moisture level (with optional random local variation)
  • gamma: controls accretion rate at frozen locations (with optional random temporal variation)

The random variation modifications, which aren't in the original Reiter algorithm, have ended up producing very nice effects--or at least the beta variation has (the gamma variation seems not to do as much).

There are four versions of the BlocksCAD code: radius 20, radius 30, radius 40 and radius 50. Up to radius 40, it works fine on Firefox, and on Chrome up to radius 30. Radius 50 is laggy on Firefox, and I haven't even tried it on Chrome. Firefox is much faster for BlocksCAD.

You can vary the thickness of the snowflake based on the simulated mass value at a given point for a further 3D effect (change the min_thickness to be less than the max_thickness for this effect), or you can introduce symmetric ridges for a pleasing visual 3D effect (make the ridge_angle be something like 3-10 degrees).

The snowflakes are readily printable--see photos. I recommend a thickness of about 2.5mm, and using a razor to scrape the flake off the printer bed.

The Thingiverse customizer was produced by exporting the code from BlocksCAD to OpenSCAD and moving the parameters to the top. Exported OpenSCAD code also generated the animation and the mosaic.

BlocksCAD does not support arrays. And it's a functional language. The evolution is thus handled by having a gigantic evolve module, which takes 421 arguments (in the radius 40 version): the iteration count, and the data for all the 420 cells being simulated (only 1/12 of the full board needs to be simulated--the rest is reconstructed by symmetry). The module then calls itself recursively, with a decremented iteration count and with evolved cells. Because of the lack of arrays, each cell's evolution has a hard-coded call to a cell evolution function. Once iteration count reaches zero, all the cells that count as frozen (data value at least 1) are drawn, as well as their (typically) 11 symmetric copies, by the draw module.

There is also a big go module that initializes the arguments for evolve.

While one could, though it would be crazy to, drag-and-drop all the hard-coded evolution code, I just wrote a python script (included: the main code is reiter.scad) that generates the BlocksCAD xml for the evolve and go modules. The drawing code, the individual cell evolution code, and the parameter initialization code was hand-written in BlocksCAD.


More from Math Art

view more

File Name



All Apps

Customizer is the easiest way to take great 3D printable designs and make them your own. Make your OpenSCAD designs infinitely more valuable by empowering the community to customize them.

App Info Launch App
Customizer Thing App

Auto-magically prepare your 3D models for 3D printing. A cloud based 3D models Preparing and Healing solution for 3D Printing, MakePrintable provides features for model repairing, wall thickness...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Print through a distributed network of 3D printing enthusiasts from across the US, at a fraction of the cost of the competitors. We want to change the world for the better through technology, an...

App Info Launch App

Treatstock is an online platform that offers decentralized manufacturing services such as 3D printing and CNC machining for clients all over the world. We offer free and instant access to comparati...

App Info Launch App

3D print your favourite design with NinjaPrototype, a professional 3D manufacture with consistent quality and speed.

App Info Launch App