1
0
Fork 0

wip: Rewrite tutorial for v3

This commit is contained in:
joostdecock 2023-09-28 09:11:06 +02:00
parent 7487f1f449
commit 32d6e938df
15 changed files with 349 additions and 303 deletions

View file

@ -3,68 +3,53 @@ title: Adding measurements
order: 130
---
FreeSewing is all about _made-to-measure_ sewing patterns;
we are going to draft our pattern according to the measurements provided to us.
FreeSewing is all about _made-to-measure_ sewing patterns -- or *parametric
design* to use a more generic term.
That means that when drafting our pattern, I will take the measurements provided
by the user into account.
Which begs the question, which measurements?
It is we, as the pattern designers, who decide which measurements are used
to draft our pattern. For our bib, the only measurement we need is the
As the pattern designers, you get to decide which measurements are used
to draft the pattern. For this bib, I am going to use the
_head circumference_.
So let's add it as a required measurement.
## Adding required measurements
In our `design/src/bib.mjs` file, on the `bib` object, there is a key called
`measurements` (line 121) that will hold a list (an array) of all required measurements
for this part.
In our `design/src/bib.mjs` file, we will add a `measurements` property to the `bib` object.
This property will be an Array (a list) holding all required measurements for this part.
We are going to use [*the official name* of the measurement](/reference/measurements). For head
I am usign [*the official name* of the measurement](/reference/measurements) here. For head
circumference, that name is `head`.
```design/src/bib.mjs
function draftBib({ part }) {
function draftBib({ part }) => {
return part
}
export const bib = {
name: 'tutorial.bib',
draft: draftBib,
from: false,
hide: {
self: false,
from: false,
after: false
},
options: {},
// start-highlight
measurements: ['head'],
// end-highlight
optionalMeasurements: [],
plugins: []
// highlight-start
measurements: [ 'head' ],
// highlight-end
}
```
Now everybody knows this part requires the `head` measurement.
From now on, this part requires the `head` measurement.
This change will also get picked up by the development environment, and we'll now see this screen:
![This screen tells us that we are missing some required measurements](./required-measurements.png)
Since it's just one measurement, let's simply enter a value by hand.
This change will also get picked up by the development environment, which will now complain that it is missing some measurements.
Since it's just one measurement, I will simply enter a value by hand.
For example `38` as 38 cm is a realistic head circumference measurement for a baby.
Enter `38` in the box, and click on **Draft Design** in the sidebar under the **View** heading.
This brings us back to our work in progress:
<Tip>
##### Why using standard measurements names matters
## Notes
### Why using standard measurements names matters
In principle, we can use any name we want for our measurements.
Our core library really doesn't care.
In principle, I can use any name I want for our measurements.
The FreeSewing core library does not care.
However, if everybody uses their own (names for) measurements, then people
aren't able to re-use their measurements across designs.
@ -73,5 +58,7 @@ So if you have any intention at all to play nice with the FreeSewing ecosystem,
please make sure to re-use the names of existing measurements, rather than
invent your own.
See our [best practices](/guides/best-practices/reuse-measurements) on this
See the [best practices](/guides/best-practices/reuse-measurements) on this
topic for details.
</Tip>