1
0
Fork 0
freesewing/sites/dev/docs/howtos/code/shared-dimensions/readme.mdx

38 lines
807 B
Text
Raw Normal View History

---
title: Share dimensions between pattern parts
---
When you have different pattern parts that look similar -- like the front
2022-02-19 08:04:25 +01:00
and back of a garment -- you may find that there's a lot of dimensions
shared between them.
2022-02-19 08:04:25 +01:00
The example below is from Aaron where dimensions are shared between
the back and front part.
Aaron has a file called `shared.mjs` that looks like this:
```js
export function dimensions(macro, points, sa) {
macro('hd', {
from: points.cfHem,
to: points.hem,
y: points.hem.y + sa * 2.5 + 15
})
// more dimensions here
}
```
In both `front.mjs` and `back.mjs` we use this code to add these shared
dimensions:
```js
import { dimensions } from './shared'
// ...
if (paperless) {
dimensions(macro, points, sa)
// ... dimensions specific to this part
}
```