1
0
Fork 0

chore(markdown): Restructuring dev docs

This commit is contained in:
Joost De Cock 2021-12-27 17:33:49 +01:00
parent 9ef46c502a
commit d42d9a9377
114 changed files with 246 additions and 1462 deletions

View file

@ -0,0 +1,28 @@
---
title: bartack
---
The `bartack` macro allows you to add a *bartack* marker to your sewing pattern.
It is provided by the [bartack plugin](/reference/plugins/bartack/).
<Example part="plugin_bartack" caption="Example of the bartack macro" />
```js
points.a = new Point(15, 15)
macro('bartack', {
anchor: points.a,
angle: 30,
length: 15
})
```
| Property | Default | Type | Description |
|-------------:|------------|------------|-------------|
| `angle` | `0` | `number` | The angle under which to draw the bartack |
| `density` | `3` | `number` | Controls how close the stitches are togeter |
| `length` | `15` | `number` | Length of the bartack |
| `nameFormat` | | `function` | A method that receives the name of the path or point and should return the name for the cloned path and or point |
| `prefix` | | `string` | A prefix to apply to the names of the generated path and points |
| `suffix` | | `string` | A suffix to apply to the names of the generated path and points |
| `width` | `3` | `number` | Width of the bartack |

View file

@ -0,0 +1,44 @@
---
title: bartackAlong
---
The `bartackAlong` macro allows you to add a *bartack* marker to your sewing pattern.
More specifically, a bartack along a path.
It is provided by the [bartack plugin](/reference/plugins/bartack/).
<Example part="plugin_bartackalong" caption="Example of the bartackAlong macro" />
```js
points.a = new Point(15, 15)
points.b = new Point(20, 20)
points.c = new Point(30, 20)
points.d = new Point(35, 15)
points.e = new Point(20, 10)
points.f = new Point(30, 10)
paths.a = new Path()
.move(points.a)
.curve(points.b, points.c, points.d)
.setRender(false)
macro('bartackAlong', {
path: paths.a
})
macro('sprinkle', {
snippet: 'notch',
on: ['e', 'f']
})
```
| Property | Default | Type | Description |
|-------------:|------------|------------|-------------|
| `angle` | `0` | `number` | The angle under which to draw the bartack |
| `density` | `3` | `number` | Controls how close the stitches are togeter |
| `length` | `15` | `number` | Length of the bartack |
| `nameFormat` | | `function` | A method that receives the name of the path or point and should return the name for the cloned path and or point |
| `path` | | `Path` | The path the bartack should follow |
| `prefix` | | `string` | A prefix to apply to the names of the generated path and points |
| `suffix` | | `string` | A suffix to apply to the names of the generated path and points |
| `width` | `3` | `number` | Width of the bartack |

View file

@ -0,0 +1,48 @@
---
title: bartackFractionAlong
---
The `bartackFractionAlong` macro allows you to add a *bartack* marker to your sewing pattern.
More specifically, a bartack along a fraction of a path.
It is provided by the [bartack plugin](/reference/plugins/bartack/).
<Example part="plugin_bartackfractionalong" caption="Example of the bartackFractionAlong macro" />
```js
points.a = new Point(15, 15)
points.b = new Point(20, 20)
points.c = new Point(30, 20)
points.d = new Point(35, 15)
points.e = new Point(20, 10)
points.f = new Point(30, 10)
paths.a = new Path()
.move(points.a)
.curve(points.b, points.c, points.d)
.setRender(false)
macro('bartackAlong', {
path: paths.a,
start: 0.2,
end: 0.8
})
macro('sprinkle', {
snippet: 'notch',
on: ['e', 'f']
})
```
| Property | Default | Type | Description |
|-------------:|------------|------------|-------------|
| `angle` | `0` | `number` | The angle under which to draw the bartack |
| `density` | `3` | `number` | Controls how close the stitches are togeter |
| `end` | `1` | `number` | At which fraction of the path length (from `0` to `1`) should the bartack end |
| `length` | `15` | `number` | Length of the bartack |
| `nameFormat` | | `function` | A method that receives the name of the path or point and should return the name for the cloned path and or point |
| `path` | | `Path` | The path the bartack should follow |
| `prefix` | | `string` | A prefix to apply to the names of the generated path and points |
| `start` | `0` | `number` | At which fraction of the path length (from `0` to `1`) should the bartack start |
| `suffix` | | `string` | A suffix to apply to the names of the generated path and points |
| `width` | `3` | `number` | Width of the bartack |

View file

@ -0,0 +1,35 @@
---
title: cutonfold
---
The `cutonfold` macro adds a *cut on fold* indicator to your pattern.
It is provided by the [cutonfold plugin](/reference/plugins/cutonfold).
<Example part="plugin_cutonfold" caption="Example of the cut on fold indicator added by this macro" />
```js
macro('cutonfold', {
from: points.cofLeft,
to: points.cofRight,
grainline: true
}
```
| Property | Default | Type | Description |
|------------:|---------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint of the *cut on fold* indicator |
| `to` | | [Point](/reference/api/point) | The endpoint of the *cut on fold* indicator |
| `margin` | 5 | [Point](/reference/api/point) | The distance in % to keep from the start/end edge |
| `offset` | 50 | Number | The distance in mm to offset from the line from start to end |
| `grainline` | `false` | Boolean | Whether this cutonfold indicator is also the grainline |
<Note>
###### It's safe to use a corner of your pattern part for this
Since this is typically used on corners, the generated cut-on-fold indicator
will not go all the way to the `to` and `from` points.
</Note>

View file

@ -0,0 +1,22 @@
---
title: Macros
for: developers
about: Complete list of all available macros and how to use them
---
Macros are a way to combine different operations into a single command,
and are typically provided by plugins.
Below is a list of available macros:
<ReadMore list />
<Note>All macros take a single object as their configuration. </Note>
<Tip>
For more info on a specific macro and examples, follow the link to the plugin that provides the macro.
</Tip>

View file

@ -0,0 +1,18 @@
---
title: flip
---
The `flip` macro flips (mirrors) an entire part vertically around the Y-axis.
It takes no arguments, and is provided by the [flip plugin](/reference/plugins/flip).
```js
macro("flip")
```
Under the hood, this macro will:
- Go through all Points in your Part, and multiply their X-coordinate by -1
- Go through all the Paths in your Part, and for each drawing operation will multiply the X-coordinare by -1
- Go through all the Snippets in your Part and multiply the X-coordinate of the anchor point by -1

View file

@ -0,0 +1,21 @@
---
title: grainline
---
The `grainline` macro adds a *grainline* indicator to your pattern.
It is provided by the [grainline plugin](/reference/plugins/grainline/).
<Example part="plugin_grainline" caption="Example of the grainline indicator added by this macro" />
```js
macro("grainline", {
from: points.grainlineFrom,
to: points.grainlineTo,
}
```
| Property | Default | Type | Description |
|------------:|---------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint of the *grainline* indicator |
| `to` | | [Point](/reference/api/point) | The endpoint of the *grainline* indicator |

View file

@ -0,0 +1,39 @@
---
title: hd
---
The `hd` macro adds a *horizontal dimension* to your pattern.
It is provided by the [dimension plugin](/reference/plugins/dimension/).
<Example
part="point_dx"
caption="An example of a horizontal dimension"
/>
```js
macro('hd', {
from: points.from,
to: points.to,
y: 25
})
```
| Property | Default | Type | Description |
|----------------:|----------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `y` | | Number | The Y-value at which to draw the dimension |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created |
| `text` | Horizontal distance | Number | The text to go on the dimension if not the from-to horizontal distance |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
<Note>
Setting a custom ID will:
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)
</Note>

View file

@ -0,0 +1,40 @@
---
title: ld
---
The `ld` macro adds a *linear dimension* to your pattern.
It is provided by the [dimension plugin](/reference/plugins/dimension/).
<Example
part="point_dist"
caption="An example of a linear dimension"
/>
```js
macro('ld', {
from: points.from,
to: points.to,
d: 0
})
```
| Property | Default | Type | Description |
|-----------------|---------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `d` | 0 | Number | The offset at which to draw the dimension |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created |
| `text` | Linear distance | Number | The text to go on the dimension if not the from-to linear distance |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
<Note>
Setting a custom ID will:
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)
</Note>

View file

@ -0,0 +1,24 @@
---
title: miniscale
---
The `miniscale` macro adds a mini *scale box* to your pattern. This box allows
users to verify their pattern is printed to scale.
The `miniscale` macro is provided by the [scalebox plugin](/reference/plugins/scalebox).
It is the mini version of [the scalebox macro](/reference/macros/scalebox/).
<Example part="plugin_scalebox" caption="Example of a scalebox (left) and miniscale (right)" />
```js
macro('miniscale', {
at: points.anchor
})
```
| Property | Default | Type | Description |
|-------------|---------|---------------------|-------------|
| `at` | | [Point](/reference/api/point) | The point to anchor the *scale box* on |
| `rotate` | 0 | Number | Rotation in degrees |

View file

@ -0,0 +1,42 @@
---
title: mirror
---
The `mirror` macro allows you to mirror points and/or paths around a mirror line.
It is provided by the [mirror plugin](/reference/plugins/mirror/).
<Example part="plugin_mirror" caption="Example of the mirror plugin" />
```js
points.a = new Point(5,5)
points.b = new Point(45,30)
points.c = new Point(5,30)
points.d = new Point(45,5)
points.mid = new Point(25,15)
paths.a = new Path()
.move(points.a)
.curve(points.b, points.c, points.d)
macro('mirror', {
mirror: [points.b, points.d],
points: [points.mid],
paths: [paths.a]
})
macro('sprinkle', {
snippet: 'notch',
on: ['mid', 'mirroredMid']
})
```
| Property | Default | Type | Description |
|-------------:|------------|------------|-------------|
| `mirror` | | `array` | Array with 2 [Point](/reference/api/point) objects that define the *mirror line* |
| `clone` | `true` | `bool` | Whether to clone mirrored points and or paths |
| `points` | | `array` | An array of [Point](/reference/api/point) objects |
| `paths` | | `array` | An array of [Path](/reference/api/path) objects |
| `prefix` | `mirrored` | `string` | A prefix to apply to the names of the clones points and or paths. Ignored if `nameFormat` is set |
| `nameFormat` | | `function` | A method that receives the name of the path or point and should return the name for the cloned path and or point |

View file

@ -0,0 +1,35 @@
---
title: pd
---
The `pd` macro adds a *path dimension* to your pattern, indicating the length of a path.
It is provided by the [dimension plugin](/reference/plugins/dimension/).
<Example part="path_length" caption="Example of a multiple path dimensions" />
```js
macro('pd', {
path: paths.example,
d: -20
})
```
| Property | Default | Type | Description |
|----------------:|---------|---------------------|-------------|
| `path` | | [Path](/reference/api/path) | The path to draw the dimension along |
| `offset` | 0 | Number | The offset at which to draw the dimension |
| `text` | Path length | Number | The text to go on the dimension if not the length of the path |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
<Note>
Setting a custom ID will:
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)
</Note>

View file

@ -0,0 +1,26 @@
---
title: rmad
---
The `rmad` macro removes all dimensions with the exception of those that were created with a custom ID.
It is provided by the [dimension plugin](/reference/plugins/dimension/).
To be able to use this plugin, you need to give your dimension an id:
```js
// This will be removed
macro('ld', {
from: points.from,
to: points.to,
d: 0,
})
// This will not removed
macro('ld', {
from: points.from,
to: points.to,
d: 0,
id: 'example' // custom ID
})
macro('rmad')
```

View file

@ -0,0 +1,30 @@
---
title: rmd
---
The `rmd` macro removes a dimension.
It is provided by the [dimension plugin](/reference/plugins/dimension/).
To be able to use this plugin, you need to give your dimension an id:
```js
macro('ld', {
from: points.from,
to: points.to,
d: 0,
id: 'example'
})
```
Now you can remove it as such:
```js
macro('rmd', {
id: 'example'
})
```
| Property | Default | Type | Description |
|----------|---------|----------|-------------|
| `id` | | `string` | The id of the dimension to remove |

View file

@ -0,0 +1,31 @@
---
title: round
---
The `round` macro rounds a corner. It is provided by the [round plugin](/reference/plugins/round/).
Note that this is only intended for 90 degree corners.
<Example part="plugin_round" caption="Example of corners rounded with the round plugin" />
```js
macro('round', {
from: points.bottomRight,
to: points.topLeft,
via: points.topRight,
radius: 20,
prefix: 'tr',
render: true
})
```
| Property | Default | Type | Description |
|------------:|---------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint towards the corner to round |
| `to` | | [Point](/reference/api/point) | The endpoint away from the corner to round |
| `via` | | [Point](/reference/api/point) | The corner to round |
| `radius` | Maximum | Number | The radius in mm in not the maximum |
| `prefix` | | String | A prefix to give to the points and paths created by this macro |
| `render` | `false` | Boolean | Whether to render the path created by this macro |
| `class` | | String | Class(es) to assign to the path created by this macro |

View file

@ -0,0 +1,27 @@
---
title: scalebox
---
The `scalebox` macro adds a *scale box* to your pattern. This box allows
users to verify their pattern is printed to scale.
The `scalebox` macro is provided by the [scalebox plugin](/reference/plugins/scalebox).
<Example part="plugin_scalebox" caption="Example of the scalebox added by this macro" />
```js
macro('scalebox', {
at: points.anchor
})
```
| Property | Default | Type | Description |
|-------------|---------|---------------------|-------------|
| `at` | | [Point](/reference/api/point) | The point to anchor the *scale box* on |
| `lead` | FreeSewing | String | The lead text above the title |
| `title` | *pattern name + version* | String | The title text |
| `text` | (\*) | String | The text below the title |
| `rotate` | 0 | Number | Rotation in degrees |
(\*) `freesewingIsMadeByJoostDeCockAndContributors \n withTheFinancialSupportOfOurPatrons`

View file

@ -0,0 +1,22 @@
---
title: sprinkle
---
The `sprinkle` macro facilitates adding snippets to your pattern in bulk.
It is by the [sprinkle plugin](/reference/plugins/sprinkle).
<Example part="plugin_sprinkle" caption="Example of button snippets sprinkled on a pattern by this macro" />
```js
macro('sprinkle', {
snippet: 'button',
on: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
})
```
| Property | Default | Type | Description |
|------------:|---------|------------------|-------------|
| `snippet` | | String | Name of the snippet to sprinkle |
| `on` | `[]` | Array of strings | An array with **the names** of points to add the snippet on |

View file

@ -0,0 +1,19 @@
---
title: title
---
The `title` macro adds a title to a pattern part.
It is provided by the [title plugin](/reference/plugins/title).
<Example part="plugin_title" caption="Example of a title added by this macro" />
| Property | Default | Type | Description |
| ----------:| :-----: | ---------------------------------------------------------- |
| `at` | | [Point](/reference/api/point) | The point at which to insert the title |
| `nr` | | String | The number of the pattern part |
| `title` | | String | The name of the pattern part. If title is not set or is an empty string, this won't be rendered, and the version will go beneath the nr.|
| `prefix` | | String | A prefix to add to the created points. This allow for more than 1 title per part, as long as you give them a different prefix.|
| `append` | `false` | Boolean | Set this to `true` to append the `nr` to any text already set in Point `at`'s attributes, rather than overwrite it |
| `rotation` | 0 | Number | An optional rotation in degrees |
| `scale` | 1 | Number | An optional scaling factor |

View file

@ -0,0 +1,41 @@
---
title: vd
---
The `vd` macro adds a *vertical dimension* to your pattern.
It is provided by the [dimension plugin](/reference/plugins/dimension/).
<Example
part="point_dy"
caption="An example of a vertical dimension"
/>
```js
macro('vd', {
from: points.from,
to: points.to,
x: 25
})
```
| Property | Default | Type | Description |
|----------------:|---------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `x` | | Number | The X-value at which to draw the dimension |
| `text` | Vertical distance | Number | The text to go on the dimension if not the from-to vertical distance |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
<Note>
Setting a custom ID will:
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)
</Note>