- Design guide
Hi there and welcome to this guide that explains how FreeSewing designs work.
it’s about what goes on under the hood each time a sewing pattern is generated by FreeSewing.
This illustration is a good starting point to gain a better understanding of the structure of a FreeSewing design:
If it looks like a lot don’t despair. I included all the info on the graphical overview, but most of it you can safely ignore and consider under the hood unless you want to do some really advanced things with FreeSewing.
If we look at our image through squinted eyes, we can identify three areas:
The left and right parts are all about how to integrate FreeSewing in your frontend. In other words, how you’ll plug it into your website, or online store, or a mobile application.
We’ll briefly cover those areas in this page. But a deep-dive into those topics is outside the scope of this guide.
On the left, we have the settings box. It represents the settings that are provided by the user.
Most of the settings are the same for all designs generated with FreeSewing as they are provided by the core library.
In other words, different patterns will required different measurements and provide different options.
But all patterns will allow users to set the
units (for example).
Settings are provided by passing them to the Pattern constructor
Since version 3 of FreeSewing, you can pass multiple sets of settings to
We call this multset support.
In 99% of the cases, you will only have a single set of settings, and you can mostly forget about this feature. It is typically used to compare different drafts or to draft for different sets of measurements (for example).
By rendering the pattern, we mean to generate the output to show to the user.
This can be done in two different ways:
The core library ships with a renderer that will render your pattern to SVG.
To use it, call
Pattern.render() which will return an SVG string.
If you’d like more fine-grained control over the output, you can use your own renderer.
To do so, call
which will return all the data you need to render your pattern in the way you prefer.
This is what we use on these documentation pages to render with React
Last but not least, we’ve arrived at the central item: the pattern itself. The pattern is a container that holds all your parts, along with a (pattern-wide) store.
In reality, your pattern is a constructor that takes the user’s settings as input and will return an instantiated pattern.
That pattern instance will have a
draft() method which will do the actual work of
drafting the pattern. Once drafted, the pattern can be rendered.
While the pattern does a lot of heavy lifting behind the scenes, we can content ourselves by understanding its different building blocks: