2021-10-17 18:26:00 +02:00
---
2021-08-25 16:09:31 +02:00
title: Adding measurements
2023-09-30 14:04:18 +02:00
order: 30
2021-10-17 18:26:00 +02:00
---
2021-08-25 16:09:31 +02:00
2023-10-21 11:46:17 +02:00
FreeSewing is all about _bespoke_ sewing patterns -- or *parametric
2023-09-28 09:11:06 +02:00
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.
2021-08-25 16:09:31 +02:00
Which begs the question, which measurements?
2023-09-28 09:11:06 +02:00
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
2022-10-09 23:47:32 +02:00
_head circumference_.
2021-08-25 16:09:31 +02:00
So let's add it as a required measurement.
2022-10-09 23:47:32 +02:00
## Adding required measurements
2021-08-25 16:09:31 +02:00
2023-09-30 14:04:18 +02:00
In our `src/bib.mjs` file, we will add a `measurements` property to the `bib` object.
2023-09-28 09:11:06 +02:00
This property will be an Array (a list) holding all required measurements for this part.
2021-08-25 16:09:31 +02:00
2024-01-16 20:04:00 -08:00
I am using [*the official name* of the measurement](/reference/measurements) here. For head
2023-01-06 19:29:29 -08:00
circumference, that name is `head`.
2021-08-25 16:09:31 +02:00
2024-09-28 13:13:48 +02:00
:::note [FIXME]
2024-03-16 21:06:19 +00:00
The `design/src/bib.mjs` "language" title on the code snippets is out of date. It is used in the tutorial from this point forward to maintain syntax-highlight not yet available for the `src/bib.mjs` title, but should be replaced with `src/bib.mjs`.
2024-09-28 13:13:48 +02:00
:::
2024-03-14 02:13:56 +00:00
```design/src/bib.mjs
function draftBib({ part }) {
2022-10-09 23:47:32 +02:00
return part
}
2021-08-25 16:09:31 +02:00
2022-10-09 23:47:32 +02:00
export const bib = {
2023-09-30 14:04:18 +02:00
name: 'fromscratch.bib',
2023-08-08 13:20:46 -05:00
draft: draftBib,
2024-03-14 02:13:56 +00:00
// highlight-start
2023-09-28 09:11:06 +02:00
measurements: [ 'head' ],
2024-03-14 02:13:56 +00:00
// highlight-end
2022-10-09 23:47:32 +02:00
}
```
2021-08-25 16:09:31 +02:00
2023-09-28 09:11:06 +02:00
From now on, this part requires the `head` measurement.
2021-08-25 16:09:31 +02:00
2023-09-28 09:11:06 +02:00
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.
2022-12-29 06:25:01 -08:00
For example `38` as 38 cm is a realistic head circumference measurement for a baby.
2021-08-25 16:09:31 +02:00
2024-09-28 13:13:48 +02:00
:::tip
2021-08-25 16:09:31 +02:00
2023-09-28 09:11:06 +02:00
##### Why using standard measurements names matters
2022-10-09 23:47:32 +02:00
2023-09-28 09:11:06 +02:00
In principle, I can use any name I want for our measurements.
The FreeSewing core library does not care.
2022-10-09 23:47:32 +02:00
However, if everybody uses their own (names for) measurements, then people
aren't able to re-use their measurements across designs.
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.
2024-09-28 13:13:48 +02:00
See the [best practices](/guides/best-practices#reuse-measurements) on this
2022-10-09 23:47:32 +02:00
topic for details.
2023-09-28 09:11:06 +02:00
2024-09-28 13:13:48 +02:00
:::