Voronoi Meshes in FreeCAD - A Quick Note
01 May 2026 - tsp
Last update 01 May 2026
9 mins
This article is a short summary on how to generate Voronoi meshes in FreeCAD and
how to apply them to arbitrary faces. Please note that the generator used in this article has not been
developed by me - this article is just a short note on how to use the components.
Voronoi diagrams are a geometric construction that partitions a surface into regions
based on proximity to a set of points, similar to what the k-means clustering algorithm
does. Given a set of seed points, each location on the surface is assigned to the nearest seed, forming a
collection of polygonal cells. The boundaries between these cells form what is commonly referred
to as a Voronoi mesh.
These structures appear naturally in many physical and biological systems - for example in cellular tissue, crack
patterns, foams or growth processes - which makes them visually appealing and useful for design purposes. In technical
applications, Voronoi patterns are often used to create lightweight structures, decorative perforations, or organic
looking lattices.
In the context of CAD and especially 3D printing, Voronoi meshes are typically not used as volumetric structures directly,
but rather as surface patterns that can be extruded or subtracted from solids. This allows the creation of complex,
irregular grids that would be difficult to design manually.
This article shows how to generate such Voronoi patterns inside FreeCAD using an existing macro, and how to apply them
both to flat and curved surfaces.

The Script
While I have already implemented the generation of Voronoi meshes in
different context, I first looked if there was already a good and useful
implementation that one can use in FreeCAD. And as it turned out there is.
Sebastian Bachmann has written an excellent FreeCAD macro and put it up
under MIT license on his GitHub repository.
This is the script that I am going to use throughout this note. It does
all of the complicated magic, this is where the real work is done.
The macro will accept a surface and generate a Sketch on it. This sketch
will contain the outline of the Voronoi diagram (the dual of the Delaunay triangulation),
which can then be extruded or subtracted.
Installing the Macro
Installing the macro is straight forward. Download the script from the
GitHub repository
and put it into the macro path of FreeCAD. In my case for FreeCAD 1.1 this
was located in ~/.local/share/FreeCAD/v1-1/Macro. There one can also
put the associated icon SVG file.
Now one can use the Macros dialog in the Macro menu to check that the
Macro is really found by FreeCAD. If this is the case one can add the Macro
to the toolbar. This is done by a right click on the toolbar and selection
of Customize. In the Macros tab one can define the macro to put into
the toolbar:
- In the Macro dropdown one selects the
Voronoi.FCMacro
- Menu text is the text that should show up in the menu, I choose
Voronoi Pattern
- Additionally one can assign the Icon

Using the Macro on Flat Surfaces
Now - how do we apply the macro? First we need to create a new body. This is done in
the part design workbench. In this we create a new sketch, draw our object and in
the end perform the pad operation. Of course any other process that yields a
body is also sufficient. Then one selects the reference surface on which the pattern
should be generated.

Now we select the macro from the toolbar. It will prompt us for:
- The number of points. These define the seed points of the Voronoi diagram.
For small objects 50-100 work very well.
- The offset. Since the macro first just traces paths the width of the
line segments is determined by the offset. This is half of the width
of the final path segment separating the islands. So a value of 0.5
yields a 1 millimeter wide grid. For manufacturing like 3D printing the
offset has to be chosen such that the resulting segment width exceeds the
minimum printable feature size - and for FDM printing with supports keep
in mind that too thin structures may rip apart when trying to separate from
support structures.
- The tessellation tolerance
- A random seed. This steers the generation of the mesh nodes. The same
seed produces the same mesh, which allows reproducible generations.

The macro will now generate a path inside a sketch

As usual this sketch can now be extruded (pad) or used to cut a pocket into your surface
via the pocket operation.

Applying the Mesh To Uneven Surfaces (Cylinders, etc.)
Now this is where it gets a bit more complicated and where I had to gather some more
information. The macro we used above itself cannot be applied to surfaces that are not planar. So the idea
goes through multiple steps and workbenches. This process works for arbitrary sketches
that we want to apply to uneven surfaces - so it also works when you have some SVG
templates that you imported. Conceptually we are going to generate the pattern on
a flat surface and then map it onto the curved geometry.
First we use the part design workbench as before. We apply the pattern as before to
a surface that has approximately the same size as our target surface. This will yield
us a sketch as before. In the following sample I will apply the pattern to a hollow
cylinder with a height of $h=40mm$ and a diameter of $d=40mm$ as well as a thickness of $1mm$.
The template I generated the pattern on thus was determined by the circumference of
the cylinder $U=d \pi$ and itโs height $h$.

Now I created the model that I wanted to apply the pattern to. This I did in the part workbench.
There I used the tube primitive to generate a tube with $r_i=19mm$, $r_o=20mm$ and $h=40mm$, that
I then moved up by $1mm$ to have space for a base plate later (itโs just faster to do this now, not
a limitation).

Now we have a body containing the template object as well as a sketch and
the target object (our tube)

The next step is to attach the sketch to the tubes face instead of the previous
template shapes face. This is done by right clicking the Sketch in the tree view and
accessing the Attachment Editor. Here we select the Reference 1 by pressing the
button and then selecting the face of the tube. In addition the attachment mode has to
be set to Deactivated.

Now we switch to the Curves Workbench. After selecting the sketch in the tree view
we apply the the Sketch on surface tool from the surfaces menu. This will finally attach
our sketch to the face we assigned in the assignment editor and create a new object that
represents this assignment.

In contrast to usage in a body where we usually apply a pad or pocket operation the
extrusion is here performed by setting the thickness of this pad on surface object.
In addition one can add a positive or negative offset. In the following example I enabled fill faces
since I did not only want to cut the outline but the whole islands. Then I set the thickness
to my wall thickness ($1mm$) and the offset to $-1mm$ since I applied the sketch to the outside with
outward facing normals.

As a last step I went back to the part workbench and performed the boolean cut operation (first
selecting the tube, then selecting the sketch-on-surface object and issuing the cut operation), which
yielded the desired skeleton

To make this a usable object I added a $1mm$ high bottom cylinder as base and on the top side
a $1mm$ high tube segment to provide an even top surface. Not shown in the following image is the
seam cube I applied (by using the intersection of a tube and a $2mm$ wide cube). This was necessary
since - as one can see in the following graphics - the Voronoi mesh produced with this method is not
seamlessly wrapping around the surface (this is caused by the generation being performed in
Euclidean space, yielding a boundary mismatch at $x=0$ and $x=U$).

To finish up I performed a quick 3D print of the object (this mesh was generated with $3mm$
width (i.e. $1.5mm$ offset) to allow easier detaching from supports used during printing.

Conclusion
Generating Voronoi meshes is - thanks to the ingenious script provided by Sebastian Bachmann - very simple.
The application to rounded surfaces requires an excursion through the Curves workbench as does the
application of arbitrary sketches do. As soon as one figured out the process it is extremely simple
to apply.
References
This article is tagged: Basics, Tutorial, DIY, 3D printing, CAD, FreeCAD