1
0
Fork 0

feat(markdown): New docs for various things

This commit is contained in:
joostdecock 2023-10-29 17:20:35 +01:00
parent 9fe93e03ce
commit 6b147d81a0
93 changed files with 1274 additions and 589 deletions

View file

@ -1,8 +0,0 @@
---
title: Store.generateMacroIds()
---
FIXME: Write docs
## Signature

View file

@ -1,5 +0,0 @@
---
title: Store.getMacroIds()
---
FIXME: Write docs

View file

@ -1,13 +0,0 @@
---
title: Store.log
---
A **Store** is initialized with a `log` property that holds methods for logging.
Specifically, the `Store.log` property holds the following methods:
<ReadMore list />
## Notes
You can override the default logging methods in the store with a plugin.

View file

@ -1,46 +0,0 @@
---
title: Store.pack()
---
A **Store** is initialized with a `log` property that holds methods for logging.
Specifically, the `Store.log` property holds the following methods:
- `Store.log.debug()`: Logs at the debug level
- `Store.log.info()`: Logs at the info level
- `Store.log.warning()`: Logs at the warning level
- `Store.log.error()`: Logs at the error level
<Note>
If errors are logged, FreeSewing will not try to layout the pattern.
</Note>
## Signature
This signature is for the `info` level, but applies to all methods/levels:
```js
undefined Store.log.info(...data)
```
All logging methods are _variadic_, they will add logs to the array at `store.logs`.
So logging with `Store.log.info()` will add the logs to the array at `Store.logs.info`.
## Example
```js
({ log, part }) => {
log.info('Hey, I am logging')
log.debug(
'I am logging too',
`But you don't see me make a big deal out if it`
)
return part
}
```
## Notes
You can override the default logging methods in the store with a plugin.

View file

@ -1,5 +0,0 @@
---
title: Store.removeMacroNodes()
---
FIXME: Write docs

View file

@ -1,5 +0,0 @@
---
title: Store.storeMacroIds()
---
FIXME: Write docs

View file

@ -3,18 +3,22 @@ title: banner
--- ---
The `banner` macro allows you to add repeating text along a path. The `banner` macro allows you to add repeating text along a path.
It is provided by the [annotations plugin](/reference/plugins/annotations).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('banner', { macro('banner', {
String id='banner',
String className='', String className='',
Number dy=1, Number dy=1,
Number repeat=10, Number repeat=10,
Number spaces=12, Number spaces=12,
Path path, Path path,
String text, String text,
Boolean force = false,
}) })
``` ```
@ -48,13 +52,18 @@ macro('banner', {
|-------------:|------------|------------|-------------| |-------------:|------------|------------|-------------|
| `className` | `` | `string` | Any additional CSS classes to apply to the text | | `className` | `` | `string` | Any additional CSS classes to apply to the text |
| `dy` | `1` | `number` | Controls how far the text will be located above the path | | `dy` | `1` | `number` | Controls how far the text will be located above the path |
| `id` | `banner` | `string` | The id of this macro instance |
| `path` | | `Path` | The Path to add the text on | | `path` | | `Path` | The Path to add the text on |
| `repeat` | `10` | `number` | The number of repetitions | | `repeat` | `10` | `number` | The number of repetitions |
| `spaces` | `12` | `number` | The number of spaces to place between repetitions | | `spaces` | `12` | `number` | The number of spaces to place between repetitions |
| `text` | | `string` | The text to place repeat along the path | | `text` | | `string` | The text to place repeat along the path |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
## Notes ## Notes
Under the hood, this macro will: Under the hood, this macro will:
- Add `data-text`, `data-text-dy`, and `data-text-class` Attributes to the path to generate the text. - Add `data-text`, `data-text-dy`, and `data-text-class` Attributes to the path to generate the text.
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.

View file

@ -1,14 +1,17 @@
--- ---
title: bannerbox title: bannerBox
--- ---
The `bannerbox` macro allows you to add a box with repeating text on it. The `bannerbox` macro allows you to add a box with repeating text on it.
It is provided by the [annotations plugin](/reference/plugins/annotations).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('bannerbox', { macro('bannerbox', {
String id='bannerbox',
String textClassName='text-xs fill-note', String textClassName='text-xs fill-note',
String boxClassName='stroke-xs stroke-note lashed', String boxClassName='stroke-xs stroke-note lashed',
Point topLeft=new Point(0,0), Point topLeft=new Point(0,0),
@ -18,6 +21,7 @@ macro('bannerbox', {
Number dy=4, Number dy=4,
Number repeat=99, Number repeat=99,
Number spaces=12, Number spaces=12,
Boolean force = false,
}) })
``` ```
@ -28,7 +32,9 @@ macro('bannerbox', {
({ Point, points, Path, paths, macro, part }) => { ({ Point, points, Path, paths, macro, part }) => {
macro('bannerbox', { macro('bannerbox', {
title: 'a bannerbox example', text: 'a bannerbox example',
topLeft: new Point(0,0),
bottomRight: new Point(80, 30)
}) })
return part return part
@ -40,15 +46,17 @@ macro('bannerbox', {
| Property | Default | Type | Description | | Property | Default | Type | Description |
|----------------:|--------------------------------|----------|-------------| |----------------:|--------------------------------|----------|-------------|
| `textClassName` | `text-xs fill-note` | `string` | CSS classes to apply to the text |
| `boxClassName` | `stroke-xs stroke-note lashed` | `string` | CSS classes to apply to the box path |
| `topLeft` | `new Point(0,0)` | `Point` | Top top-left corner of the box |
| `bottomRight` | `new Point(100,100)` | `Point` | Top top-left corner of the box | | `bottomRight` | `new Point(100,100)` | `Point` | Top top-left corner of the box |
| `text` | `` | `string` | The text to place repeat along the box path | | `boxClassName` | `stroke-xs stroke-note lashed` | `string` | CSS classes to apply to the box path |
| `margin` | `15` | `number` | Controls the margin the box will apply |
| `dy` | `4` | `number` | Controls how far the text will be located above the path | | `dy` | `4` | `number` | Controls how far the text will be located above the path |
| `id` | `bannerbox` | `string` | The ID of this macro instance |
| `margin` | `15` | `number` | Controls the margin the box will apply |
| `repeat` | `99` | `number` | The number of text repetitions. See [banner macro][banner] | | `repeat` | `99` | `number` | The number of text repetitions. See [banner macro][banner] |
| `spaces` | `12` | `number` | The number of spaces to place between repetitions. See [banner macro][banner] | | `spaces` | `12` | `number` | The number of spaces to place between repetitions. See [banner macro][banner] |
| `text` | `` | `string` | The text to place repeat along the box path |
| `textClassName` | `text-xs fill-note` | `string` | CSS classes to apply to the text |
| `topLeft` | `new Point(0,0)` | `Point` | Top top-left corner of the box |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
## Notes ## Notes
@ -68,4 +76,6 @@ needed might be a best practice to ensure that text completely surrounds
the bannerbox, even if the pattern is scaled down, allowing more text to the bannerbox, even if the pattern is scaled down, allowing more text to
fit around the box. fit around the box.
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
[banner]: /reference/macros/banner [banner]: /reference/macros/banner

View file

@ -4,12 +4,15 @@ title: bartack
The `bartack` macro allows you to add a _bartack_ marker to your sewing The `bartack` macro allows you to add a _bartack_ marker to your sewing
pattern. pattern.
It is provided by the [annotations plugin](/reference/plugins/annotations).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('banner', { macro('banner', {
String id='bartack',
Point anchor, Point anchor,
Number angle=0, Number angle=0,
Number density=3, Number density=3,
@ -17,6 +20,7 @@ macro('banner', {
String prefix='', String prefix='',
String suffix='', String suffix='',
Number width=3, Number width=3,
Boolean force = false,
}) })
``` ```
@ -43,13 +47,14 @@ macro('banner', {
| `anchor` | | `Point` | The point to start the bartack from | | `anchor` | | `Point` | The point to start the bartack from |
| `angle` | `0` | `number` | The angle under which to draw the bartack | | `angle` | `0` | `number` | The angle under which to draw the bartack |
| `density` | `3` | `number` | Controls how close the stitches are together | | `density` | `3` | `number` | Controls how close the stitches are together |
| `id` | `bartack` | `string` | The ID of this macro instance |
| `length` | `15` | `number` | Length of the bartack | | `length` | `15` | `number` | Length of the bartack |
| `prefix` | | `string` | A prefix to apply to the name of the generated path | | `prefix` | | `string` | A prefix to apply to the name of the generated path |
| `suffix` | | `string` | A suffix to apply to the name of the generated path | | `suffix` | | `string` | A suffix to apply to the name of the generated path |
| `width` | `3` | `number` | Width of the bartack | | `width` | `3` | `number` | Width of the bartack |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
## Result ## Notes
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}bartack${suffix}` | Path generated for the bartack marker |

View file

@ -4,12 +4,15 @@ title: bartackAlong
The `bartackAlong` macro allows you to add a _bartack_ marker to your sewing pattern. The `bartackAlong` macro allows you to add a _bartack_ marker to your sewing pattern.
More specifically, a bartack along a path. More specifically, a bartack along a path.
It is provided by the [annotations plugin](/reference/plugins/annotations).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('banner', { macro('bartackAlong', {
String id='bartack'
Number angle=0, Number angle=0,
Number density=3, Number density=3,
Number length=15, Number length=15,
@ -17,6 +20,7 @@ macro('banner', {
String prefix='', String prefix='',
String suffix='', String suffix='',
Number width=3, Number width=3,
Boolean force = false,
}) })
``` ```
@ -47,14 +51,16 @@ macro('banner', {
|-------------:|------------|------------|-------------| |-------------:|------------|------------|-------------|
| `angle` | `0` | `number` | The angle under which to draw the bartack | | `angle` | `0` | `number` | The angle under which to draw the bartack |
| `density` | `3` | `number` | Controls how close the stitches are together | | `density` | `3` | `number` | Controls how close the stitches are together |
| `id` | `bartackalong` | `string` | The ID of this macro instance |
| `length` | `15` | `number` | Length of the bartack | | `length` | `15` | `number` | Length of the bartack |
| `path` | | `Path` | The path the bartack should follow | | `path` | | `Path` | The path the bartack should follow |
| `prefix` | | `string` | A prefix to apply to the name of the generated path | | `prefix` | | `string` | A prefix to apply to the name of the generated path |
| `suffix` | | `string` | A suffix to apply to the name of the generated path | | `suffix` | | `string` | A suffix to apply to the name of the generated path |
| `width` | `3` | `number` | Width of the bartack | | `width` | `3` | `number` | Width of the bartack |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
## Notes
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}bartack${suffix}` | Path generated for the bartack marker |

View file

@ -4,12 +4,15 @@ title: bartackFractionAlong
The `bartackFractionAlong` macro allows you to add a _bartack_ marker to your The `bartackFractionAlong` macro allows you to add a _bartack_ marker to your
sewing pattern. More specifically, a bartack along a fraction of a path. sewing pattern. More specifically, a bartack along a fraction of a path.
It is provided by the [annotations plugin](/reference/plugins/annotations).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('banner', { macro('bartackFractionAlong', {
String id="bartack",
Number angle=0, Number angle=0,
Number density=3, Number density=3,
Number end=1, Number end=1,
@ -19,6 +22,7 @@ macro('banner', {
Number start=0, Number start=0,
String suffix='', String suffix='',
Number width=3, Number width=3,
Boolean force = false,
}) })
``` ```
@ -58,9 +62,8 @@ macro('banner', {
| `start` | `0` | `number` | At which fraction of the path length (from `0` to `1`) should the bartack start | | `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 name of the generated path | | `suffix` | | `string` | A suffix to apply to the name of the generated path |
| `width` | `3` | `number` | Width of the bartack | | `width` | `3` | `number` | Width of the bartack |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
## Result ## Notes
| Generated Element | Description | This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
|-------------------|-------------|
| `paths.${prefix}bartack${suffix}` | Path generated for the bartack marker |

View file

@ -1,5 +1,5 @@
--- ---
title: crossbox title: crossBox
--- ---
The `crossbox` macro is used to mark a feature on a sewing pattern The `crossbox` macro is used to mark a feature on a sewing pattern
@ -7,15 +7,18 @@ to attach and reinforce an attachment between two pieces.
This is regularly done by sewing along the outside of the pieces This is regularly done by sewing along the outside of the pieces
that needs to be joined, and then sewing along the diagonals too. that needs to be joined, and then sewing along the diagonals too.
It is provided by [plugin-annotations](/reference/plugins/annotations/). It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('crossbox', { macro('crossbox', {
Point from, String id='crossbox',
Point to, Point topLeft,
Point bottomRight,
String text, String text,
Boolean force = false,
}) })
``` ```
@ -24,25 +27,13 @@ macro('crossbox', {
<Example caption="An example of the crossbox macro"> <Example caption="An example of the crossbox macro">
```js ```js
({ Point, points, Path, paths, macro, part }) => { ({ Point, points, Path, paths, macro, part }) => {
points.partTL = new Point(0,0)
points.partTR = new Point(0,70)
points.partBR = new Point(50,70)
points.partBL = new Point(50,0)
paths.part = new Path()
.move(points.partTL)
.line(points.partTR)
.line(points.partBR)
.line(points.partBL)
.close()
points.tl = new Point(5,5) points.tl = new Point(5,5)
points.br = new Point(45,25) points.br = new Point(45,25)
macro('crossbox', { macro('crossbox', {
from: points.tl, topLeft: new Point(5, 5),
to: points.br, bottomRight: new Point(45, 25),
text: 'attach here', text: 'Attach here',
}) })
return part return part
@ -54,22 +45,13 @@ macro('crossbox', {
| Property | Default | Type | Description | | Property | Default | Type | Description |
|----------------:|----------|---------------------|-------------| |----------------:|----------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The top left point of the crossbox | | `bottomRight` | | [Point](/reference/api/point) | The bottom right point of the crossbox |
| `to` | | [Point](/reference/api/point) | The bottom right point of the crossbox | | `topLeft` | | [Point](/reference/api/point) | The top left point of the crossbox |
| `id` | `crossbox` | `string` | The ID of this macro instance |
| `text` | | String | Optional text to go in the center of the crossbox | | `text` | | String | Optional text to go in the center of the crossbox |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
## Result ## Notes
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
| Generated Element | Description |
|-------------------|-------------|
| `points.${id}_boxTopLeft` | Point Top Left of the outer box |
| `points.${id}_boxTopRight` | Point Top Right of the outer box |
| `points.${id}_boxBottomLeft` | Point Bottom Left of the outer box |
| `points.${id}_boxBottomRight` | Point Bottom Right of the outer box |
| `points.${id}_topCrossTL` | Point Top Left of the inner box |
| `points.${id}_topCrossTR` | Point Top Right of the inner box |
| `points.${id}_topCrossBL` | Point Bottom Left of the inner box |
| `points.${id}_topCrossBR` | Point Bottom Right of the inner box |
| `points.${id}_textAnchor` | Point for the text |
| `paths.${id}crossBox` | Path for the outer box |
| `paths.${id}_topCross` | Path for the inner box and cross |

View file

@ -1,20 +1,24 @@
--- ---
title: cutonfold title: cutOnFold
--- ---
The `cutonfold` macro adds a _cut on fold_ indicator to your pattern. The `cutonfold` macro adds a _cut on fold_ indicator to your pattern.
It is provided by the [annotations plugin](/reference/plugins/annotations).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('cutonfold', { macro('cutonfold', {
String id="cutonfold",
Point from, Point from,
Boolean grainline=false, Boolean grainline=false,
Number margin=5, Number margin=5,
Number offset=15, Number offset=15,
String prefix='', String prefix='',
Point to, Point to,
Boolean force = false,
}) })
``` ```
@ -45,47 +49,20 @@ macro('cutonfold', {
| Property | Default | Type | Description | | Property | Default | Type | Description |
|------------:|---------|---------------------|-------------| |------------:|---------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint of the _cut on fold_ indicator | | `from` | | [Point](/reference/api/point) | The startpoint of the _cut on fold_ indicator |
| `id` | `cutonfold` | `string` | The ID of this macro instance |
| `to` | | [Point](/reference/api/point) | The endpoint 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 | | `margin` | 5 | [Point](/reference/api/point) | The distance in % to keep from the start/end edge |
| `offset` | 15 | Number | The distance in mm to offset from the line from start to end | | `offset` | 15 | Number | The distance in mm to offset from the line from start to end |
| `prefix` | 'cutonfold' | String | A prefix to apply to the names of the generated path and points | | `prefix` | 'cutonfold' | String | A prefix to apply to the names of the generated path and points |
| `grainline` | `false` | Boolean | Whether this cutonfold indicator is also the grainline | | `grainline` | `false` | Boolean | Whether this cutonfold indicator is also the grainline |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
## Result
| Generated Element | Description |
|------|-------------|
| `paths.${prefix}Cutonfold` | The Path for the _cut on fold_ indicator |
| `points.${prefix}From` | Point used to create the path |
| `points.${prefix}Via1` | Point used to create the path |
| `points.${prefix}Via2` | Point used to create the path |
| `points.${prefix}To}` | Point used to create the path |
## Notes ## Notes
### Place outside `complete` This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
The `cutonfold` macro should be placed outside of `complete` blocks
in the part's draft method.
This is because it provides information about the part's foldline and
possible grainline,
information that is always needed by the cutting layout regardless of
whether `complete` details and graphics are shown on the pattern.
The `cutonfold` macro will automatically show or hide the cut on fold
indicator based on the `complete` setting.
### It's safe to use a corner of your pattern part for this ### 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 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. will not go all the way to the `to` and `from` points.
### Removing the cut on fold indicator
If you inherit a part with a cut on fold indicator and you'd like to remove it,
you can do so by passing `false` to the macro:
```js
macro('cutonfold', false)
```

View file

@ -49,10 +49,12 @@ Now you can use these macros in your part:
## Macros we maintain ## Macros we maintain
Below is a list of macros from [the plugins we maintain](/reference/plugins): Below is a list of macros from [the plugins we maintain](/reference/plugins).
<Note compact noP>
We use camelCase here, but macro names are case-insensitive
</Note>
<ReadMore list /> <ReadMore list />
## Notes
We recommend allowing to *undo* a macro by passing `false` as its parameter.

View file

@ -3,8 +3,17 @@ title: flip
--- ---
The `flip` macro flips (mirrors) an entire part vertically around either the The `flip` macro flips (mirrors) an entire part vertically around either the
X-axis or the Y-axis. It is provided by the [flip X-axis or the Y-axis.
plugin](/reference/plugins/flip).
It is provided by the [flip plugin](/reference/plugins/flip).
<Note>
##### Not a core-plugins macro
The `flip` macro is not provided by the [core-plugins](/reference/plugins/core),
so you need to load the [flip plugin](/reference/plugins/flip) explicitly
if you want to use it.
</Note>
## Signature ## Signature

View file

@ -3,7 +3,14 @@ title: gore
--- ---
The `gore` macro facilitates the drafting of [gores][1] to create spherical or other roundish objects. They are are typically used in hats. The `gore` macro facilitates the drafting of [gores][1] to create spherical or other roundish objects. They are are typically used in hats.
It is provided by the [gore plugin](/reference/plugins/grainline/).
<Note>
##### Not a core-plugins macro
The `gore` macro is not provided by the [core plugins](/reference/plugins/core),
so you need to load the [gore plugin](/reference/plugins/gore) explicitly
if you want to use it.
</Note>
## Signature ## Signature
@ -51,17 +58,6 @@ macro('gore', {
| `class` | | boolean | Any classes to add to the generated path | | `class` | | boolean | Any classes to add to the generated path |
| `prefix` | | string | A prefix to apply to the names of the generated path and points | | `prefix` | | string | A prefix to apply to the names of the generated path and points |
## Result
| Generated Element | Description |
|------|-------------|
| `paths.${prefix}seam` | The Path for the gore |
| `points.${prefix}p1` | Point for the gore tip |
| `points.${prefix}p2` | Point between the tip and side corner |
| `points.${prefix}p3` | Point for the gore side corner |
| `points.${prefix}Cp1` | Control Point used to create the curved path |
| `points.${prefix}Cp2` | Control Point used to create the curved path |
[1]: https://en.wikipedia.org/wiki/Gore_\(segment\) [1]: https://en.wikipedia.org/wiki/Gore_\(segment\)
[2]: /reference/api/point [2]: /reference/api/point

View file

@ -3,7 +3,9 @@ title: grainline
--- ---
The `grainline` macro adds a _grainline_ indicator to your pattern. The `grainline` macro adds a _grainline_ indicator to your pattern.
It is provided by the [annotations plugin](/reference/plugins/annotations).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
@ -12,6 +14,7 @@ macro('grainline', {
Point from, Point from,
Point to, Point to,
String text=grainline, String text=grainline,
Boolean force = false,
}) })
``` ```
@ -43,36 +46,11 @@ macro('grainline', {
| `from` | | [Point][1] | The startpoint of the _grainline_ indicator | | `from` | | [Point][1] | The startpoint of the _grainline_ indicator |
| `to` | | [Point][1] | The endpoint of the _grainline_ indicator | | `to` | | [Point][1] | The endpoint of the _grainline_ indicator |
| `text` | 'grainline' | string | The text to put on the _grainline_ indicator | | `text` | 'grainline' | string | The text to put on the _grainline_ indicator |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.grainline` | The Path for the _grainline_ indicator |
| `points.grainlineFrom` | Point used to create the path |
| `points.grainlineTo` | Point used to create the path |
[1]: /reference/api/point [1]: /reference/api/point
## Notes ## Notes
### Place outside `complete` This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
The `grainline` macro should be placed outside of `complete` blocks
in the part's draft method.
This is because it provides information about the part's grainline,
information that is always needed by the cutting layout regardless of
whether `complete` details and graphics are shown on the pattern.
The `grainline` macro will automatically show or hide the grainline
indicator based on the `complete` setting.
### Removing the grainline indicator
If you inherit a part with a grainline indicator and you'd like to remove it,
you can do so by passing `false` to the macro:
```js
macro('grainline', false)
```

View file

@ -3,19 +3,22 @@ title: hd
--- ---
The `hd` macro adds a _horizontal dimension_ to your pattern. The `hd` macro adds a _horizontal dimension_ to your pattern.
It is provided by the [annotations plugin](/reference/plugins/annotations).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('hd', { macro('hd', {
String id, String id = 'hd',
Point from, Point from,
Boolean noEndMarker, Boolean noEndMarker,
Boolean noStartMarker, Boolean noStartMarker,
String text, String text,
Point to, Point to,
Number y, Number y,
Boolean force = false,
}) })
``` ```
@ -28,7 +31,8 @@ macro('hd', {
macro('hd', { macro('hd', {
from: new Point(0,0), from: new Point(0,0),
to: new Point(100,0), to: new Point(100,0),
y:15, y: 15,
force: 1,
}) })
return part return part
@ -43,23 +47,13 @@ macro('hd', {
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension | | `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension | | `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `y` | | Number | The Y-value at which to draw the dimension | | `y` | | Number | The Y-value at which to draw the dimension |
| `id` | auto-assigned | String | A custom ID under which paths and points will be created | | `id` | `hd` | `string` | The ID of this macro instance |
| `text` | Horizontal distance | Number | The text to go on the dimension if not the from-to horizontal distance | | `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 | | `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker | | `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `paperless` is `false` |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${id}` | Path for the span of the dimension |
| `paths.${id}_ls` | Path for the leader to the start of the dimension |
| `paths.${id}_le` | Path for the leader to the end of the dimension |
## Notes ## Notes
Setting a custom ID will: This macro takes the `paperless` setting into account and won't output anything when both `paperless` and `force` are `false`.
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)

View file

@ -3,19 +3,22 @@ title: ld
--- ---
The `ld` macro adds a _linear dimension_ to your pattern. The `ld` macro adds a _linear dimension_ to your pattern.
It is provided by the [annotations plugin](/reference/plugins/annotations).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('ld', { macro('ld', {
Number d, Number d,
String id, String id = 'ld',
Point from, Point from,
Boolean noEndMarker, Boolean noEndMarker,
Boolean noStartMarker, Boolean noStartMarker,
String text, String text,
Point to, Point to,
Boolean force = false,
}) })
``` ```
@ -29,6 +32,7 @@ macro('ld', {
from: new Point(0,0), from: new Point(0,0),
to: new Point(100,20), to: new Point(100,20),
d:15, d:15,
force: true,
}) })
return part return part
@ -43,22 +47,12 @@ macro('ld', {
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension | | `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension | | `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `d` | 0 | Number | The offset at which to draw the dimension | | `d` | 0 | Number | The offset at which to draw the dimension |
| `id` | auto-assigned | String | A custom ID under which paths and points will be created | | `id` | `ld` | `string` | The ID of this macro instance |
| `text` | Linear distance | Number | The text to go on the dimension if not the from-to linear distance | | `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 | | `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker | | `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `paperless` is `false` |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${id}` | Path for the span of the dimension |
| `paths.${id}_ls` | Path for the leader to the start of the dimension |
| `paths.${id}_le` | Path for the leader to the end of the dimension |
## Notes ## Notes
Setting a custom ID will: This macro takes the `paperless` setting into account and won't output anything when both `paperless` and `force` are `false`.
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)

View file

@ -1,5 +1,5 @@
--- ---
title: miniscale title: miniScale
--- ---
The `miniscale` macro adds a mini _scale box_ to your pattern. This box allows The `miniscale` macro adds a mini _scale box_ to your pattern. This box allows
@ -7,9 +7,10 @@ users to verify their pattern is printed to scale.
The white inside of the box provides a metric scale, and the black outside The white inside of the box provides a metric scale, and the black outside
of the box provides an imperial scale. of the box provides an imperial scale.
The `miniscale` macro is provided by the [annotations A miniscale is the mini version of [the scalebox macro](/reference/macros/scalebox/).
plugin](/reference/plugins/annotations).
It is the mini version of [the scalebox macro](/reference/macros/scalebox/). It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
@ -17,6 +18,7 @@ It is the mini version of [the scalebox macro](/reference/macros/scalebox/).
macro('miniscale', { macro('miniscale', {
Point at, Point at,
Number rotate, Number rotate,
Boolean force = false,
}) })
``` ```
@ -41,23 +43,8 @@ macro('miniscale', {
|------------:|---------|---------------------|-------------| |------------:|---------|---------------------|-------------|
| `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on | | `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on |
| `rotate` | 0 | Number | Rotation in degrees | | `rotate` | 0 | Number | Rotation in degrees |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.__miniscaleImperial` | Path of the imperial, outer box |
| `paths.__miniscaleMetric` | Path of the metric, inner box |
| `points.__miniscaleImperial` | Point anchoring the imperial text |
| `points.__miniscaleMetric` | Point anchoring the metric text |
| `points.__miniscale[Metric/Imperial][Top/Bottom][Left/Right]` | Points for the corners of the boxes |
## Notes ## Notes
If you inherit a part with a miniscale on it and you'd like to remove all This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
points and paths generated by the miniscale macro, you can do so by passing
`false` to the macro:
```js
macro('miniscale', false)
```

View file

@ -2,8 +2,10 @@
title: mirror title: mirror
--- ---
The `mirror` macro allows you to mirror points and/or paths around a mirror The `mirror` macro allows you to mirror points and/or paths around a mirror line.
line. It is provided by the [mirror plugin](/reference/plugins/mirror/).
It is provided by the [mirror plugin](/reference/plugins/mirror/), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
@ -61,12 +63,3 @@ macro('mirror', {
| `prefix` | `mirrored` | `string` | A prefix to apply to the names of the clones points and or paths. Ignored if `nameFormat` is set | | `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 as a first argument and one of `path` or `point` as the second argument and should return the name for the cloned path and or point | | `nameFormat` | | `function` | A method that receives the name of the path or point as a first argument and one of `path` or `point` as the second argument and should return the name for the cloned path and or point |
## Result
If `nameFormat` is set, its method determines the names of cloned, mirrored Points and Paths.
If it is not set, the names are as below.
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}${Pathname}` | The cloned, mirrored Path(s) (with the first letter of pathname capitalized) |
| `points.${prefix}${Pointname}` | The cloned, mirrored Point(s) (with the first letter of pointname capitalized) |

View file

@ -4,7 +4,9 @@ title: pd
The `pd` macro adds a _path dimension_ to your pattern, indicating the length The `pd` macro adds a _path dimension_ to your pattern, indicating the length
of a path. of a path.
It is provided by the [annotations plugin](/reference/plugins/annotations).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
@ -16,6 +18,7 @@ macro('pd', {
Boolean noEndMarker, Boolean noEndMarker,
Boolean noStartMarker, Boolean noStartMarker,
String text, String text,
Boolean force = false,
}) })
``` ```
@ -32,6 +35,7 @@ macro('pd', {
macro('pd', { macro('pd', {
path: paths.example, path: paths.example,
d: 15, d: 15,
force: true,
}) })
return part return part
@ -46,21 +50,12 @@ macro('pd', {
| `path` | | [Path](/reference/api/path) | The path to draw the dimension along | | `path` | | [Path](/reference/api/path) | The path to draw the dimension along |
| `d` | 10 | Number | The offset at which to draw the dimension | | `d` | 10 | 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 | | `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 which paths and points will be created | | `id` | `pd` | `string` | The ID of this macro instance |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker | | `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker | | `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `paperless` is `false` |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${id}` | Path for the span of the dimension |
| `paths.${id}_ls` | Path for the leader to the start of the dimension |
| `paths.${id}_le` | Path for the leader to the end of the dimension |
## Notes ## Notes
Setting a custom ID will: This macro takes the `paperless` setting into account and won't output anything when both `paperless` and `force` are `false`.
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)

View file

@ -7,17 +7,25 @@ lines perpendicular to the line going from `from` to `to`.
The `pleat` macro follows the convention of paths being counter-clockwise to The `pleat` macro follows the convention of paths being counter-clockwise to
determine what is the inside or outside of the part. determine what is the inside or outside of the part.
It is provided by [plugin-annotations](/reference/plugins/annotations/). It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('pleat', { macro('pleat', {
String id = 'pleat',
Point from, Point from,
Point to, Point to,
String prefix = 'pleat',
Number margin = 35, Number margin = 35,
Boolean reverse = false, Boolean reverse = false,
Boolean force = false,
Object calsses = {
arrow: 'note',
from: 'note',
to: 'note dashed',
},
}) })
``` ```
@ -35,7 +43,7 @@ macro('pleat', {
.attr('class', 'fabric') .attr('class', 'fabric')
points.from = new Point(40,0) points.from = new Point(40,0)
points.to = new Point(30,0) points.to = new Point(10,0)
macro('pleat', { macro('pleat', {
from: points.from, from: points.from,
@ -52,19 +60,16 @@ macro('pleat', {
| Property | Default | Type | Description | | Property | Default | Type | Description |
|----------------:|----------|---------------------|-------------| |----------------:|----------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The start point of the pleat | | `from` | | [Point](/reference/api/point) | The start point of the pleat |
| `id` | `pleat` | `string` | The ID of this macro instance |
| `to` | | [Point](/reference/api/point) | The end point of the pleat | | `to` | | [Point](/reference/api/point) | The end point of the pleat |
| `prefix` | 'pleat' | String | The prefix to be used for creating all the points and paths |
| `margin` | 35 | Number | The size (in mm) of the pleat lines | | `margin` | 35 | Number | The size (in mm) of the pleat lines |
| `reverse` | `false` | Boolean | Reverses the two pleat lines and the arrow | | `reverse` | `false` | Boolean | Reverses the two pleat lines and the arrow |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
| `classes.arrow` | `note` | `string` | CSS classes to apply to the arrow |
| `classes.from` | `note` | `string` | CSS classes to apply to the line at the `from` point |
| `classes.to` | `note dashed` | `string` | CSS classes to apply to the line at the `to` point |
## Result ## Notes
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
| Generated Element | Description |
|-------------------|-------------|
| `points.${prefix}From` | Copy of the `from` Point |
| `points.${prefix}To` | Copy of the `to` Point |
| `points.${prefix}FromIn` | Point for the inside of the `from` path |
| `points.${prefix}ToIn` | Point for the inside of the `to` path |
| `paths.${prefix}PleatFrom` | Path forming the from line |
| `paths.${prefix}PleatTo` | Path forming the to line |
| `paths.${prefix}PleatArrow` | Path forming the arrow |

View file

@ -1,5 +1,5 @@
--- ---
title: ringsector title: ringSector
--- ---
The `ringsector` macro drafts a ring sector, which is like a part of a donut The `ringsector` macro drafts a ring sector, which is like a part of a donut
@ -20,6 +20,7 @@ if you want to use it.
```js ```js
macro('ringsector', { macro('ringsector', {
String id='ringsector',
Point center = new Point(0,0), Point center = new Point(0,0),
Number angle, Number angle,
Number insideRadius, Number insideRadius,
@ -50,6 +51,7 @@ macro('ringsector', {
| Property | Default | Type | Description | | Property | Default | Type | Description |
|---------------:|-------------------|------------|-------------| |---------------:|-------------------|------------|-------------|
| `id` | `ringsector` | `string` | The ID of this macro instance |
| `center` | `new Point(0,0)` | [Point][1] | The center point of the ring sector | | `center` | `new Point(0,0)` | [Point][1] | The center point of the ring sector |
| `angle` | | Number | The angle the ring sector should cover | | `angle` | | Number | The angle the ring sector should cover |
| `insideRadius` | | Number | The inside radius of the ring sector | | `insideRadius` | | Number | The inside radius of the ring sector |
@ -61,17 +63,6 @@ macro('ringsector', {
## Notes ## Notes
### Nodes generated by this macro
This macro will add points and a single path to your part.
Their IDs will be saved in store under:
`parts.{part.name}.macros.@freesewing/plugin-ringsector.ids.{id}`
### Removing a ring sector
If you inherit a part with a ring sector drafted by this macro and you'd like to remove it,
you can do so with [the rmringsector macro](/reference/macros/rmringsector).
### Example when rotate=true ### Example when rotate=true
<Example caption="Example of a ring sector drafted by this macro when rotate is truthy"> <Example caption="Example of a ring sector drafted by this macro when rotate is truthy">

View file

@ -1,41 +1,14 @@
--- ---
title: rmad title: rmaD
--- ---
The `rmad` macro removes all dimensions with the exception of those that were The `rmad` macro removes all dimensions (all nodes created by `hd`, `vd`, `ld`, and `pd` macros).
created with a custom ID.
It is provided by the [annotations plugin](/reference/plugins/annotations). It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('rmad') macro('rmad')
``` ```
## Example
<Example caption="An example of the rmad macro">
```js
({ Point, macro, part }) => {
// This will be removed
macro('ld', {
from: new Point(10, 0),
to: new Point(40, 0),
d: 5,
})
// This will not removed
macro('ld', {
from: new Point(10, 20),
to: new Point(80, 20),
d: 5,
id: 'example' // custom ID
})
macro('rmad')
return part
}
```
</Example>

View file

@ -0,0 +1,14 @@
---
title: rmaHd
---
The `rmahd` macro removes all horizontal dimensions (all nodes created by `hd` macros).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmahd')
```

View file

@ -0,0 +1,14 @@
---
title: rmaLd
---
The `rmald` macro removes all linear dimensions (all nodes created by `ld` macros).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmald')
```

View file

@ -0,0 +1,14 @@
---
title: rmaPd
---
The `rmapd` macro removes all path dimensions (all nodes created by `pd` macros).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmapd')
```

View file

@ -0,0 +1,14 @@
---
title: rmaVd
---
The `rmaVd` macro removes all path dimensions (all nodes created by `vd` macros).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmavd')
```

View file

@ -0,0 +1,16 @@
---
title: rmBanner
---
The `rmBanner` macro removes the nodes added by [the banner macro](/reference/macros/banner).
It is the recommended way to remove (the effects of) a `banner` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmBanner', id = 'banner')
```

View file

@ -0,0 +1,15 @@
---
title: rmBannerBox
---
The `rmBannerBox` macro removes the nodes added by [the bannerBox macro](/reference/macros/bannerbox).
It is the recommended way to remove (the effects of) a `bannerBox` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmBannerBox', id = 'bannerbox')
```

View file

@ -0,0 +1,16 @@
---
title: rmBartack
---
The `rmBartack` macro removes the nodes added by [the bartack macro](/reference/macros/bartack).
It is the recommended way to remove (the effects of) a `bartack` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmBartack', id = 'bartack')
```

View file

@ -0,0 +1,15 @@
---
title: rmBartackAlong
---
The `rmBartackAlong` macro removes the nodes added by [the bartackAlong macro](/reference/macros/bartackalong).
It is the recommended way to remove (the effects of) a `bartackAlong` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmBartackAlong', id = 'bartack')
```

View file

@ -0,0 +1,15 @@
---
title: rmBartackFractionAlong
---
The `rmBartackFractionAlong` macro removes the nodes added by [the bartackFractionAlong macro](/reference/macros/bartackfractionalong).
It is the recommended way to remove (the effects of) a `bartackFractionAlong` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmBartackFractionAlong', id = 'bartack')
```

View file

@ -0,0 +1,15 @@
---
title: rmCrossBox
---
The `rmCrossBox` macro removes the nodes added by [the crossBox macro](/reference/macros/crossbox).
It is the recommended way to remove (the effects of) a `crossbox` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmCrossBox', id = 'crossbox')
```

View file

@ -0,0 +1,15 @@
---
title: rmCutOnFold
---
The `rmCutOnFold` macro removes the nodes added by [the cutOnFold macro](/reference/macros/cutonfold).
It is the recommended way to remove (the effects of) a `cutOnFold` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmCutOnFold', id = 'cutonfold')
```

View file

@ -1,49 +0,0 @@
---
title: rmd
---
The `rmd` macro removes a dimension.
It is provided by the [annotations plugin](/reference/plugins/annotations).
To be able to use this plugin, you need to give your dimension an id:
## Signature
```js
macro('rmd', {
String id
})
```
## Example
<Example caption="An example of the rmd macro">
```js
({ Point, macro, part }) => {
macro('ld', {
from: new Point(10, 0),
to: new Point(40, 0),
d: 5,
id: 'da',
})
macro('ld', {
from: new Point(10, 20),
to: new Point(80, 20),
d: 5,
id: 'db',
})
macro('rmd', { id: 'db' })
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|----------|---------|----------|-------------|
| `id` | | `string` | The id of the dimension to remove |

View file

@ -0,0 +1,15 @@
---
title: rmGrainline
---
The `rmGrainline` macro removes the nodes added by [the grainline macro](/reference/macros/grainline).
It is the recommended way to remove (the effects of) a `grainline` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmGrainline', id = 'grainline')
```

View file

@ -0,0 +1,15 @@
---
title: rmHd
---
The `rmHd` macro removes the nodes added by [the hd macro](/reference/macros/hd).
It is the recommended way to remove (the effects of) a `hd` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmHd', id = 'hd')
```

View file

@ -0,0 +1,15 @@
---
title: rmLd
---
The `rmLd` macro removes the nodes added by [the ld macro](/reference/macros/ld).
It is the recommended way to remove (the effects of) a `ld` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmLd', id = 'ld')
```

View file

@ -0,0 +1,15 @@
---
title: rmMiniScale
---
The `rmMiniscale` macro removes the nodes added by [the miniscale macro](/reference/macros/miniscale).
It is the recommended way to remove (the effects of) a `miniscale` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmMiniscale', id = 'miniscale')
```

View file

@ -0,0 +1,15 @@
---
title: rmPd
---
The `rmPd` macro removes the nodes added by [the pd macro](/reference/macros/pd).
It is the recommended way to remove (the effects of) a `pd` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmPd', id = 'pd')
```

View file

@ -0,0 +1,15 @@
---
title: rmPleat
---
The `rmPleat` macro removes the nodes added by [the pleat macro](/reference/macros/pleat).
It is the recommended way to remove (the effects of) a `pleat` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmPleat', id = 'pleat')
```

View file

@ -1,5 +1,5 @@
--- ---
title: rmringsector title: rmRingSector
--- ---
The `rmringsector` macro removes the nodes added by [the ringsector macro](/reference/macros/ringsector). The `rmringsector` macro removes the nodes added by [the ringsector macro](/reference/macros/ringsector).
@ -21,36 +21,3 @@ if you want to use it.
macro('rmringsector', String id = 'ringsector') macro('rmringsector', String id = 'ringsector')
``` ```
## Example
<Example caption="Example of a ring sector removed by this macro">
```js
({ Point, macro, Path, paths, part }) => {
macro('ringsector', {
angle: 60,
insideRadius: 30,
outsideRadius: 45,
})
macro('rmringsector')
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|---------:|--------------|--------|-------------|
| `id` | `ringsector` | String | The id of the ringsector macro to remove |
## Notes
### Nodes removed by this macro
This macro will remove points and a single path from your part.
Their IDs have been saved in store under:
`parts.{part.name}.macros.@freesewing/plugin-ringsector.ids.{id}`
by the [the ringsector macro](/reference/macros/ringsector).

View file

@ -0,0 +1,15 @@
---
title: rmScaleBox
---
The `rmScalebox` macro removes the nodes added by [the scalebox macro](/reference/macros/scalebox).
It is the recommended way to remove (the effects of) a `scalebox` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmScalebox', id = 'scalebox')
```

View file

@ -0,0 +1,15 @@
---
title: rmSewTogether
---
The `rmSewTogether` macro removes the nodes added by [the sewTogether macro](/reference/macros/sewtogether).
It is the recommended way to remove (the effects of) a `sewtogether` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmSewTogether', id = 'sewtogether')
```

View file

@ -0,0 +1,15 @@
---
title: rmTitle
---
The `rmTitle` macro removes the nodes added by [the title macro](/reference/macros/title).
It is the recommended way to remove (the effects of) a `title` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmTitle', id = 'title')
```

View file

@ -0,0 +1,15 @@
---
title: rmVd
---
The `rmVd` macro removes the nodes added by [the vd macro](/reference/macros/vd).
It is the recommended way to remove (the effects of) a `vd` macro.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('rmVd', id = 'vd')
```

View file

@ -2,13 +2,16 @@
title: round title: round
--- ---
The `round` macro creates a rounded corner. It is provided by the [round The `round` macro creates a rounded corner.
plugin](/reference/plugins/round/).
It is provided by [plugin-round](/reference/plugins/round), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('round', { macro('round', {
String id = 'round',
String class, String class,
Point from, Point from,
Boolean hide, Boolean hide,
@ -42,6 +45,7 @@ macro('round', {
| Property | Default | Type | Description | | Property | Default | Type | Description |
|------------:|---------|---------------------|-------------| |------------:|---------|---------------------|-------------|
| `id` | `round` | `string` | The ID of this macro instance |
| `from` | | [Point](/reference/api/point) | The startpoint towards the corner to round | | `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 | | `to` | | [Point](/reference/api/point) | The endpoint away from the corner to round |
| `via` | | [Point](/reference/api/point) | The cornerpoint to round | | `via` | | [Point](/reference/api/point) | The cornerpoint to round |
@ -50,15 +54,6 @@ macro('round', {
| `hide` | `true` | Boolean | Whether to hide the path created by this macro | | `hide` | `true` | Boolean | Whether to hide the path created by this macro |
| `class` | | String | Class(es) to assign to the path created by this macro | | `class` | | String | Class(es) to assign to the path created by this macro |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}Rounded` | Path for the rounded corner |
| `points.${prefix}Start` | Point for the start of the rounded corner |
| `points.${prefix}End` | Point for the end of the rounded corner |
| `points.${prefix}Cp1` | Control Point used to create the curved path |
| `points.${prefix}Cp2` | Control Point used to create the curved path |
## Notes ## Notes

View file

@ -7,18 +7,20 @@ to verify their pattern is printed to scale.
The white inside of the box provides a metric scale, and the black outside The white inside of the box provides a metric scale, and the black outside
of the box provides an imperial scale. of the box provides an imperial scale.
The `scalebox` macro is is provided by the [annotations It is provided by [plugin-annotations](/reference/plugins/annotations), which is
plugin](/reference/plugins/annotations). part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('scalebox', { macro('scalebox', {
String id = 'scalebox',
Point at, Point at,
String lead, String lead,
Number rotate, Number rotate,
String text, String text,
String title, String title,
Boolean force = false,
}) })
``` ```
@ -43,34 +45,16 @@ macro('scalebox', {
| Property | Default | Type | Description | | Property | Default | Type | Description |
|------------:|---------|---------------------|-------------| |------------:|---------|---------------------|-------------|
| `id` | `scalebox` | `string` | The ID of this macro instance |
| `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on | | `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on |
| `lead` | FreeSewing | String | The lead text above the title | | `lead` | FreeSewing | String | The lead text above the title |
| `title` | _pattern name + version_ | String | The title text | | `title` | _pattern name + version_ | String | The title text |
| `text` | (\*) | String | The text below the title | | `text` | (\*) | String | The text below the title |
| `rotate` | 0 | Number | Rotation in degrees | | `rotate` | 0 | Number | Rotation in degrees |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
(\*) `freesewingIsMadeByJoostDeCockAndContributors \n withTheFinancialSupportOfOurPatrons` (\*) `freesewingIsMadeByJoostDeCockAndContributors \n withTheFinancialSupportOfOurPatrons`
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.__scaleboxImperial` | Path of the imperial, outer box |
| `paths.__scaleboxMetric` | Path of the metric, inner box |
| `points.__scaleboxLead` | Point anchoring the lead text above the title |
| `points.__scaleboxTitle` | Point anchoring the title text |
| `points.__scaleboxTitle` | Point anchoring the text below the title |
| `points.__scaleboxImperial` | Point anchoring the imperial text |
| `points.__scaleboxMetric` | Point anchoring the metric text |
| `points.__scalebox[Metric/Imperial][Top/Bottom][Left/Right]` | Points for the corners of the boxes |
## Notes ## Notes
### Removing the scalebox This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
If you inherit a part with a scalebox on it and you'd like to remove all points and paths
generated by the scalebox macro, you can do so by passing `false` to the macro:
```js
macro('scalebox', false)
```

View file

@ -5,17 +5,20 @@ title: sewTogether
The `sewTogether` macro is used to mark where two parts of the same `part` need The `sewTogether` macro is used to mark where two parts of the same `part` need
to be sewn together. This happens when you want to construct a cone for instance. to be sewn together. This happens when you want to construct a cone for instance.
It is provided by [plugin-annotations](/reference/plugins/annotations/). It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('sewTogether', { macro('sewTogether', {
String id = 'sewtogether',
Point from, Point from,
Point to, Point to,
Point middle = null, Point middle = null,
Boolean hinge = false, Boolean hinge = false,
String prefix = 'sewtogether', String prefix = 'sewtogether',
Boolean force = false,
}) })
``` ```
@ -54,28 +57,19 @@ macro('sewTogether', {
| Property | Default | Type | Description | | Property | Default | Type | Description |
|----------------:|----------|---------------------|-------------| |----------------:|----------|---------------------|-------------|
| `id` | `sewtogether` | `string` | The ID of this macro instance |
| `from` | | [Point](/reference/api/point) | One side of what needs to be sewn together | | `from` | | [Point](/reference/api/point) | One side of what needs to be sewn together |
| `to` | | [Point](/reference/api/point) | The other side of what needs to be sewn together | | `to` | | [Point](/reference/api/point) | The other side of what needs to be sewn together |
| `middle` | null | [Point](/reference/api/point) | The middle point (when ommitted, it will be halfway between `from` and `to`) | | `middle` | null | [Point](/reference/api/point) | The middle point (when ommitted, it will be halfway between `from` and `to`) |
| `prefix` | 'sewtogether' | String | The prefix to be used for creating all the points and paths | | `prefix` | 'sewtogether' | String | The prefix to be used for creating all the points and paths |
| `hinge ` | `false` | Boolean | Draws the hinge line | | `hinge ` | `false` | Boolean | Draws the hinge line |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `points.${prefix}From` | Copy of the `from` Point |
| `points.${prefix}FromCP` | Control Point of the `from` Point |
| `points.${prefix}Middle` | Copy of the `middle` Point |
| `points.${prefix}To` | Copy of the `to` Point |
| `points.${prefix}ToCP` | Control Point of the `to` Point |
| `points.${prefix}Hinge` | Point for the hinge line |
| `paths.${prefix}SewTogether` | Path forming the line |
| `paths.${prefix}SewTogetherHinge` | Path forming the hinge line |
## Notes ## Notes
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
This macro is aware of the `sa` setting. Normally it draws the This macro is aware of the `sa` setting. Normally it draws the
hinge line on the inside of the part (following the counter-clockwise hinge line on the inside of the part (following the counter-clockwise
standard). When the `sa` is provided it draws the hinge line on the standard). When the `sa` is provided it draws the hinge line on the
outside, up to the `sa` line. outside, up to the `sa` line.

View file

@ -3,7 +3,9 @@ title: sprinkle
--- ---
The `sprinkle` macro facilitates adding snippets to your pattern in bulk. The `sprinkle` macro facilitates adding snippets to your pattern in bulk.
It is provided by the [sprinkle plugin](/reference/plugins/sprinkle).
It is provided by [plugin-sprinkle](/reference/plugins/sprinkle), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
@ -54,8 +56,3 @@ macro('sprinkle', {
| `scale` | 1 | number | Scale for the individual Snippets | | `scale` | 1 | number | Scale for the individual Snippets |
| `rotate` | 0 | number | Rotation for the individual Snippets | | `rotate` | 0 | number | Rotation for the individual Snippets |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `snippets.${pointname}-${snippet}` | The Snippet(s) created |

View file

@ -3,12 +3,15 @@ title: title
--- ---
The `title` macro adds a title to a pattern part. The `title` macro adds a title to a pattern part.
It is provided by the [annotations plugin](/reference/plugins/annotations).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('title', { macro('title', {
String id = 'title',
String align, String align,
Boolean append, Boolean append,
Point at, Point at,
@ -18,6 +21,7 @@ macro('title', {
Number rotation, Number rotation,
Number scale, Number scale,
String title, String title,
Boolean force = false,
}) })
``` ```
@ -56,19 +60,15 @@ macro('title', {
| `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 | | `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 |
| `at` | | [Point](/reference/api/point) | The point at which to insert the title | | `at` | | [Point](/reference/api/point) | The point at which to insert the title |
| `cutlist` | `true` | Boolean | Whether to include cutting instructions | | `cutlist` | `true` | Boolean | Whether to include cutting instructions |
| `id` | `title` | `string` | The ID of this macro instance |
| `nr` | | String | The number of the pattern part | | `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.| | `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.| | `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.|
| `rotation` | 0 | Number | An optional rotation in degrees | | `rotation` | 0 | Number | An optional rotation in degrees |
| `scale` | 1 | Number | An optional scaling factor | | `scale` | 1 | Number | An optional scaling factor |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
## Result ## Notes
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
| Generated Element | Description |
|-------------------|-------------|
| `points._${prefix}_titleNr` | Point anchoring the part number text |
| `points._${prefix}_titleName` | Point anchoring the part name text |
| `points._${prefix}_titleCut_${material}_${i}` | Points anchoring the cutting instructions, by material key and instruction index |
| `points._${prefix}_titlePattern` | Point anchoring the pattern name text |
| `points._${prefix}_titleFor` | Point anchoring the name of the person for whom the pattern was made, if that information exists |
| `points._${prefix}_exportDate` | Point anchoring the pattern export date |

View file

@ -3,19 +3,22 @@ title: vd
--- ---
The `vd` macro adds a _vertical dimension_ to your pattern. The `vd` macro adds a _vertical dimension_ to your pattern.
It is provided by the [annotations plugin](/reference/plugins/annotations).
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature ## Signature
```js ```js
macro('vd', { macro('vd', {
String id, String id = 'vd',
Point from, Point from,
Boolean noEndMarker, Boolean noEndMarker,
Boolean noStartMarker, Boolean noStartMarker,
String text, String text,
Point to, Point to,
Number x, Number x,
Boolean force = false,
}) })
``` ```
@ -29,6 +32,7 @@ macro('vd', {
from: new Point(0,0), from: new Point(0,0),
to: new Point(0,40), to: new Point(0,40),
x:10, x:10,
force: true,
}) })
// Prevent clipping // Prevent clipping
@ -49,21 +53,11 @@ macro('vd', {
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension | | `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `x` | | Number | The X-value at which to draw 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 | | `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 which paths and points will be created | | `id` | `vd` | `string` | The ID of this macro instance |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker | | `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker | | `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `paperless` is `false` |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${id}` | Path for the span of the dimension |
| `paths.${id}_ls` | Path for the leader to the start of the dimension |
| `paths.${id}_le` | Path for the leader to the end of the dimension |
## Notes ## Notes
Setting a custom ID will: This macro takes the `paperless` setting into account and won't output anything when both `paperless` and `force` are `false`.
- Allow removal of the dimension with [the `rmd` macro](/reference/macros/rmd)
- Prevent removal of the dimension with [the `rmad` macro](/reference/macros/rmad/)

View file

@ -3,18 +3,25 @@ title: plugin-annotations
--- ---
Published as [@freesewing/plugin-annotations][1], this plugin provides a Published as [@freesewing/plugin-annotations][1], this plugin provides a
variety of macros and snippets to annotate designs. variety of snippets, macros, and store methods to annotate designs.
It is part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Snippets
The annotations plugin provides the following snippets: The annotations plugin provides the following snippets:
- [bnotch](/reference/snippets/button)
- [button](/reference/snippets/button) - [button](/reference/snippets/button)
- [buttonhole](/reference/snippets/button) - [buttonhole](/reference/snippets/button)
- [buttonhole-start](/reference/snippets/button)
- [buttonhole-end](/reference/snippets/button) - [buttonhole-end](/reference/snippets/button)
- [buttonhole-start](/reference/snippets/button)
- [eyelet](/reference/snippets/eyelet)
- [logo](/reference/snippets/logo) - [logo](/reference/snippets/logo)
- [notch](/reference/snippets/button) - [notch](/reference/snippets/button)
- [bnotch](/reference/snippets/button) - [snap-stud](/reference/snippets/snap-stud)
- [snap-socket](/reference/snippets/snap-socket)
## Macros
The annotations plugin provides the following macros: The annotations plugin provides the following macros:
- [banner](/reference/macros/banner) - [banner](/reference/macros/banner)
@ -28,7 +35,30 @@ The annotations plugin provides the following macros:
- [hd](/reference/macros/hd) - [hd](/reference/macros/hd)
- [ld](/reference/macros/ld) - [ld](/reference/macros/ld)
- [rmad](/reference/macros/rmad) - [rmad](/reference/macros/rmad)
- [rmd](/reference/macros/rmd) - [rmahd](/reference/macros/rmahd)
- [rmald](/reference/macros/rmald)
- [rmapd](/reference/macros/rmapd)
- [rmavd](/reference/macros/rmavd)
- [rmbanner](/reference/macros/rmbanner)
- [rmbannerbox](/reference/macros/rmbannerbox)
- [rmbartack](/reference/macros/rmbartack)
- [rmbartackAlong](/reference/macros/rmbartackalong)
- [rmbartackFractionAlong](/reference/macros/rmbartackfractionalong)
- [rmcrossbox](/reference/macros/rmcrossbox)
- [rmcutonfold](/reference/macros/rmcutonfold)
- [rmgrainline](/reference/macros/rmgrainline)
- [rmahd](/reference/macros/rmahd)
- [rmald](/reference/macros/rmald)
- [rmapd](/reference/macros/rmapd)
- [rmavd](/reference/macros/rmavd)
- [rmhd](/reference/macros/rmhd)
- [rmld](/reference/macros/rmld)
- [rmpd](/reference/macros/rmpd)
- [rmvd](/reference/macros/rmvd)
- [rmpleat](/reference/macros/rmpleat)
- [rmscalebox](/reference/macros/rmscalebox)
- [rmsewTogether](/reference/macros/rmsetogether)
- [rmtitle](/reference/macros/rmtitle)
- [pd](/reference/macros/pd) - [pd](/reference/macros/pd)
- [pleat](/reference/macros/pleat) - [pleat](/reference/macros/pleat)
- [scalebox](/reference/macros/scalebox) - [scalebox](/reference/macros/scalebox)
@ -36,28 +66,53 @@ The annotations plugin provides the following macros:
- [title](/reference/macros/title) - [title](/reference/macros/title)
- [vd](/reference/macros/vd) - [vd](/reference/macros/vd)
The annotations plugin also provides [methods to the Store for adding cutting instructions](#methods) ## Store methods
The annotations plugin also provides store methods:
<Tip> For an in-depth look at how to add cutting instructions to your part, see our [cutlist how-to](/howtos/design/cutlist) </Tip>
- [flag.error()](/reference/store-methods/flag.error)
- [flag.fixme()](/reference/store-methods/flag.fixme)
- [flag.info()](/reference/store-methods/flag.info)
- [flag.note()](/reference/store-methods/flag.note)
- [flag.preset()](/reference/store-methods/flag.preset)
- [flag.tip()](/reference/store-methods/flag.tip)
- [flag.warn()](/reference/store-methods/flag.warn)
- [unflag.error()](/reference/store-methods/unflag.error)
- [unflag.fixme()](/reference/store-methods/unflag.fixme)
- [unflag.info()](/reference/store-methods/unflag.info)
- [unflag.note()](/reference/store-methods/unflag.note)
- [unflag.preset()](/reference/store-methods/unflag.preset)
- [unflag.tip()](/reference/store-methods/unflag.tip)
- [unflag.warn()](/reference/store-methods/unflag.warn)
## Installation ## Installation
<Note>
This plugin is part of [core-plugins](/reference/plugins/core), so there is no
need to install it manually unless you want to forego loading of core plugins,
yet still want to load this plugin.
</Note>
```sh ```sh
npm install @freesewing/plugin-annotations npm install @freesewing/plugin-annotations
``` ```
## Usage ## Usage
<Note>
This plugin is part of [core-plugins](/reference/plugins/core), so there is no
need to load it manually unless you want to forego loading of core plugins,
yet still want to load this plugin.
</Note>
Either [add it as a part plugin](/reference/api/part/config/plugins) in your Either [add it as a part plugin](/reference/api/part/config/plugins) in your
design, or [add it to a pattern instance with design, or [add it to a pattern instance with
Pattern.use()](/reference/api/pattern/use). Pattern.use()](/reference/api/pattern/use).
To import the plugin for use: To import the plugin for use:
```js ```js
import { annotationsPlugin } from '@freesewing/plugin-banner' import { plugin } from '@freesewing/plugin-annotations'
// or
import { pluginAnnotations } from '@freesewing/plugin-banner'
``` ```
## Methods ## Methods

View file

@ -1,37 +0,0 @@
---
title: plugin-bundle
---
Published as [@freesewing/plugin-bundle][1], this plugin bundles the most
commonly used FreeSewing time plugins in one handy package.
Specifically, loading this plugin will have the same effect as loading these
plugins individually:
- [plugin-annotations](/reference/plugins/annotations)
- [plugin-measurements](/reference/plugins/measurements) : Make extra, calculated measurements available to your patterns
- [plugin-mirror](/reference/plugins/mirror) : Mirror points and paths in your patterns
- [plugin-round](/reference/plugins/round) : Create rounded corners in your patterns
- [plugin-sprinkle](/reference/plugins/sprinkle) : Add multiple snippets to your patterns
## Installation
```bash
npm install @freesewing/plugin-bundle
```
## Usage
Either [add it as a part plugins](/reference/api/part/config/plugins) in your
design, or [add it to a pattern instance with
Pattern.use()](/reference/api/pattern/use).
To import the plugin for use:
```js
import { bundlePlugin } from '@freesewing/plugin-bundle'
// or
import { pluginBundle } from '@freesewing/plugin-bundle'
```
[1]: https://www.npmjs.com/package/@freesewing/plugin-bundle

View file

@ -0,0 +1,39 @@
---
title: core-plugins
---
Published as [@freesewing/core-plugins][1], our core plugins bundles the most
commonly used FreeSewing plugins in one bundle that is loaded by the core
library by default.
Specifically, loading this plugin will have the same effect as loading these
plugins individually:
- [plugin-annotations](/reference/plugins/annotations)
- [plugin-measurements](/reference/plugins/measurements) : Make extra, calculated measurements available to your patterns
- [plugin-mirror](/reference/plugins/mirror) : Mirror points and paths in your patterns
- [plugin-round](/reference/plugins/round) : Create rounded corners in your patterns
- [plugin-sprinkle](/reference/plugins/sprinkle) : Add multiple snippets to your patterns
- [plugin-binpack](/reference/plugins/binpack) : The default bin packing algorithm used to handle auto-generated layouts in core
## Installation
```bash
npm install @freesewing/core-plugins
```
## Usage
The core plugins are loaded by default so there is nothing to be done to use them.
If you do not want to load the core plugins, pass `noCorePlugins: true` to your Design constructor:
```mjs
const design = new Design({
parts: myParts,
noCorePlugins: true
})
```
[1]: https://www.npmjs.com/package/@freesewing/core-plugins

View file

@ -3,8 +3,9 @@ title: Plugins
--- ---
FreeSewing uses a modular approach where functionality can be extended with FreeSewing uses a modular approach where functionality can be extended with
plugins. Plugins can provide macros, store methods, or use any of the lifecycle plugins. Plugins can provide [snippets](/reference/snippets),
hooks. [macros](/reference/macros), [store methods](/reference/store-methods), or
use any of the [lifecycle hooks](/reference/hooks).
## Using plugins ## Using plugins
@ -14,16 +15,18 @@ Plugins can be either
To import a plugin for use: To import a plugin for use:
```js ```js
import { namePlugin } from { @freesewing/plugin-name } import { plugin } from { @freesewing/plugin-gore }
// or
import { pluginName } from { @freesewing/plugin-name }
``` ```
<Tip> <Tip>
For convenience, each plugin is exported in two name formats: For convenience, each plugin is exported as several names exports:
"plugin\<Name>" and "\<name\>Plugin".
For example, either `pluginBanner` or `bannerPlugin` can be used. - `plugin`
- `pluginName`
- `namePlugin`
For example, `@freesewing/plugin-gore` has named exports `plugin`, `pluginGore`, and `gorePlugin` that all are the same thing.
</Tip> </Tip>

View file

@ -5,7 +5,8 @@ title: bnotch
The `bnotch` snippet is intended for notches at the back, or when you The `bnotch` snippet is intended for notches at the back, or when you
need an alternative to the default `notch`. need an alternative to the default `notch`.
It is provided by [plugin-annotations](/reference/plugins/annotations/). It is provided by [plugin-annotations](/reference/plugins/annotations/), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Example ## Example

View file

@ -4,7 +4,8 @@ title: button
The `button` snippet is used to mark button placement. The `button` snippet is used to mark button placement.
It is provided by [plugin-annotations](/reference/plugins/annotations/). It is provided by [plugin-annotations](/reference/plugins/annotations/), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Example ## Example

View file

@ -6,8 +6,8 @@ The `buttonhole-end` snippet is used to mark buttonhole placement.
This particular snippet places the buttonhole's end on its This particular snippet places the buttonhole's end on its
anchor point. anchor point.
It is provided by [plugin-annotations](/reference/plugins/annotations/). It is provided by [plugin-annotations](/reference/plugins/annotations/), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Example ## Example

View file

@ -6,8 +6,8 @@ The `buttonhole-start` snippet is used to mark buttonhole placement.
This particular snippet places the buttonhole's start on its This particular snippet places the buttonhole's start on its
anchor point. anchor point.
It is provided by [plugin-annotations](/reference/plugins/annotations/). It is provided by [plugin-annotations](/reference/plugins/annotations/), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Example ## Example

View file

@ -6,8 +6,8 @@ The `buttonhole` snippet is used to mark buttonhole placement.
This particular snippet places the buttonhole centrally on its This particular snippet places the buttonhole centrally on its
anchor point. anchor point.
It is provided by [plugin-annotations](/reference/plugins/annotations/). It is provided by [plugin-annotations](/reference/plugins/annotations/), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Example ## Example

View file

@ -0,0 +1,27 @@
---
title: eyelet
---
The `eyelet` snippet is used to mark an eyelet, which is a small reinforced opening or hole.
It is provided by [plugin-annotations](/reference/plugins/annotations/), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Example
<Example caption="An example of the eyelet snippet">
```js
({ Point, Path, paths, Snippet, snippets, part }) => {
snippets.demo = new Snippet('eyelet', new Point(0,0))
// Prevent clipping
paths.diag = new Path()
.move(new Point(-50,-4))
.move(new Point(50,4))
return part
}
```
</Example>

View file

@ -4,7 +4,8 @@ title: logo
The `logo` snippet inserts the FreeSewing logo. The `logo` snippet inserts the FreeSewing logo.
It is provided by [plugin-annotations](/reference/plugins/annotations/). It is provided by [plugin-annotations](/reference/plugins/annotations/), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Example ## Example

View file

@ -4,7 +4,8 @@ title: notch
The `notch` snippet is intended for notches. The `notch` snippet is intended for notches.
It is provided by [plugin-annotations](/reference/plugins/annotations/). It is provided by [plugin-annotations](/reference/plugins/annotations/), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Example ## Example

View file

@ -4,7 +4,8 @@ title: snap-socket
The `snap-socket` snippet is used to mark the socket part of a snap button. The `snap-socket` snippet is used to mark the socket part of a snap button.
It is provided by [plugin-annotations](/reference/plugins/annotations/). It is provided by [plugin-annotations](/reference/plugins/annotations/), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Example ## Example

View file

@ -4,7 +4,9 @@ title: snap-stud
The `snap-stud` snippet is used to mark the stud part of a snap button. The `snap-stud` snippet is used to mark the stud part of a snap button.
It is provided by [plugin-annotations](/reference/plugins/annotations/). It is provided by [plugin-annotations](/reference/plugins/annotations/), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Example ## Example
<Example caption="An example of the snap-stud snippet"> <Example caption="An example of the snap-stud snippet">

View file

@ -0,0 +1,31 @@
---
title: removeMacroNodes()
---
Removes nodes generated by macro `id`.
By nodes, we mean paths, points, and so on that have been created by the macro.
When a macro properly uses a combination of `generateMacroIds()` and
`storeMacroIds()`, this method will fully handle its removal.
## Signature
```mjs
Object store.removeMacroNodes(
String id,
macro = store.activeMacro,
part = store.activePart,
)
```
The method takes a (macro) id and removes all nodes created by this macro,
It uses the active macro and part from the store, Or you can pass in `macro` and `part` to not use the active macro or part.
## Example
```mjs
undefined store.removeMacroNodes('macroId')
```

View file

@ -0,0 +1,27 @@
---
title: Store Methods
---
Store methods are typically provided by plugins and attached to
the store to make them available during the drafting process.
Some of FreeSewing's core library functionality is implemented
as store methods to allow plugins to override this functinoality.
Examples include log handling and pattern layout algorithm.
All store methods below are either provided by plugins we maintain,
or are the default store methods as provided by the core library.
## Signature
```js
null method(object Store, object config)
```
A store method receives as its first parameter [the Store object](/reference/api/store), and
as second parameter a single configuration object for the method.
## Store methods we maintain
<ReadMore list />

View file

@ -0,0 +1,26 @@
---
title: flag.error()
---
This flags information at the `error` level.
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.error`.
The core library does nothing with this info, it is merely stored, much like logs are.
However, in our own UI on FreeSewing.org, we use this mechanism to allow
designer to flag information to the user, and even suggest changes to the
pattern configuration.
## Signature
```js
undefined Store.flag.error({
title: 'Oh no',
desc: 'Something went very wrong'
})
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).

View file

@ -0,0 +1,26 @@
---
title: flag.fixme()
---
This flags information at the `fixme` level.
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.fixme`.
The core library does nothing with this info, it is merely stored, much like logs are.
However, in our own UI on FreeSewing.org, we use this mechanism to allow
designer to flag information to the user, and even suggest changes to the
pattern configuration.
## Signature
```js
undefined Store.flag.fixme({
title: 'Not yet implemented',
desc: 'Something is unfinished'
})
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).

View file

@ -0,0 +1,71 @@
---
title: flag.info()
---
This flags information at the `info` level.
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.info`.
The core library does nothing with this info, it is merely stored, much like logs are.
However, in our own UI on FreeSewing.org, we use this mechanism to allow
designer to flag information to the user, and even suggest changes to the
pattern configuration.
## Signature
```js
undefined Store.flag.info({
title: 'flag:expandIsOn.t',
desc: 'flag:expandIsOn.d',
suggest: {
text: 'flag:disable',
icon: 'expand',
update: {
settings: ['expand', null],
},
},
})
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
The example above is from our implementation, which uses the following properties:
## Configuration
| Property | Type | Description |
| ----------:| ------------------- | ----------- |
| `id` | String | An ID for this flag message. If none is provided, `title` will be used |
| `title` | String | The title of the message |
| `desc` | String | The description of the message |
| `suggest.text` | String | Text to go on the button to implement the suggested configuration change |
| `suggest.icon` | String | Icon name to go on the button to implement the suggested configuration change |
| `suggest.update` | Object | Object describing the changes to apply to the configuration if the user accepts the suggestion |
Note that the `suggest` object is optional. Without it, it will merely display a message to the user.
However, when a suggest key is present, a button will be created that the user can click to accept the suggested changes.
## Example
```js
({ store, part }) => {
store.flag.info({
msg: `aaron:cutNeckBinding`,
notes: ['flag:saUnused', 'flag:partHiddenByExpand'],
replace: {
width: units(w),
length: units(l),
},
suggest: {
text: 'flag:show',
icon: 'expand',
update: {
settings: ['expand', 1],
},
},
})
return part
}
```

View file

@ -0,0 +1,26 @@
---
title: flag.note()
---
This flags information at the `note` level.
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.note`.
The core library does nothing with this info, it is merely stored, much like logs are.
However, in our own UI on FreeSewing.org, we use this mechanism to allow
designer to flag information to the user, and even suggest changes to the
pattern configuration.
## Signature
```js
undefined Store.flag.note({
title: 'Something good to know',
desc: 'Longer message here'
})
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).

View file

@ -0,0 +1,41 @@
---
title: flag.preset()
---
The `flag.preset()` method is a way to flag a pre-defined flag object.
There are currently two such pre-defined flags provided by the annotations-plugin:
- `expandIsOn`
- `expandIsOff`
They inform the user about the effect of the `expand` setting on the pattern, when `expand`
is on or off respectively.
## Signature
```js
undefined Store.flag.preset(string preset)
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implemntation.
The example above is from our implementation, which uses the following properties:
## Configuration
| Property | Type | Description |
| ----------:| ------------------- | ----------- |
| `preset` | String | The ID of an existing preset |
## Example
```js
({ store, expand, part }) => {
store.flag.preset(expand
? 'expandIsOn'
: 'expandIsOff'
)
return part
}
```

View file

@ -0,0 +1,26 @@
---
title: flag.tip()
---
This flags information at the `tip` level.
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.tip`.
The core library does nothing with this info, it is merely stored, much like logs are.
However, in our own UI on FreeSewing.org, we use this mechanism to allow
designer to flag information to the user, and even suggest changes to the
pattern configuration.
## Signature
```js
undefined Store.flag.tip({
title: 'Something good to know',
desc: 'Longer message here'
})
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).

View file

@ -0,0 +1,26 @@
---
title: flag.warn()
---
This flags information at the `warn` level.
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.warn`.
The core library does nothing with this info, it is merely stored, much like logs are.
However, in our own UI on FreeSewing.org, we use this mechanism to allow
designer to flag information to the user, and even suggest changes to the
pattern configuration.
## Signature
```js
undefined Store.flag.warn({
title: 'Something to be mindful of',
desc: 'Longer message here'
})
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).

View file

@ -0,0 +1,37 @@
---
title: generateMacroIds()
---
The `generateMacroIds()` store method generates IDs to be used in macros.
It is the recommended way for macros that add nodes to the pattern (by nodes we
mean points, paths and so on) to avoid naming clashes.
## Signature
```mjs
Object store.generateMacroIds(
Array keys,
String id,
macro = store.activeMacro
)
```
The method takes a list of strings, and an ID which is typically the ID passed
to the macro. You can optionally specify the macro name via `macro` although
you almost certainly want to rely on the default behavior which is to load the
active macro name from the store.
## Example
```mjs
const ids = store.generateMacroIds(
[
'start',
'end',
'middle'
],
'macroId'
)
```

View file

@ -0,0 +1,30 @@
---
title: getMacroIds()
---
Retrieve data for macro IDs generated via [`generateMacroIds()`](/reference/store-methods/generatemacroids) and stored
via [`storeMacroIds()`](/reference/store-methods/storemacroids).
## Signature
```mjs
Object store.getMacroIds(
String id,
macro = store.activeMacro,
part = store.activePart,
)
```
The method takes an id and retrieves the data stored under the macro IDs for the active macro and active part.
Or, if you want to, you can pass in `macro` and `part` to not use the active macro or part.
## Example
```mjs
const ids = store.getMacroIds('macroId')
```
It is a best practice to return the result of this method from your macro.

View file

@ -1,5 +1,5 @@
--- ---
title: Store.log.debug() title: log.debug()
--- ---
This is the logging method for logs of `debug` level. This is the logging method for logs of `debug` level.

View file

@ -1,5 +1,5 @@
--- ---
title: Store.log.error() title: log.error()
--- ---
This is the logging method for logs of `error` level. This is the logging method for logs of `error` level.

View file

@ -1,5 +1,5 @@
--- ---
title: Store.log.info() title: log.info()
--- ---
This is the logging method for logs of `info` level. This is the logging method for logs of `info` level.

View file

@ -1,5 +1,5 @@
--- ---
title: Store.log.warn() title: log.warn()
--- ---
This is the logging method for logs of `warn` level (warning). This is the logging method for logs of `warn` level (warning).

View file

@ -0,0 +1,11 @@
---
title: pack()
---
The `pack()` store method is used to automatically layout patterns in the core library.
It is implemented as a store method to allow you to override this method and implement
your own algorithm to generate the layout.
<Fixme>
Document this in more detail
</Fixme>

View file

@ -0,0 +1,31 @@
---
title: removeMacroNodes()
---
Removes nodes generated by macro `id`.
By nodes, we mean paths, points, and so on that have been created by the macro.
When a macro properly uses a combination of `generateMacroIds()` and
`storeMacroIds()`, this method will fully handle its removal.
## Signature
```mjs
Object store.removeMacroNodes(
String id,
macro = store.activeMacro,
part = store.activePart,
)
```
The method takes a (macro) id and removes all nodes created by this macro,
It uses the active macro and part from the store, Or you can pass in `macro` and `part` to not use the active macro or part.
## Example
```mjs
undefined store.removeMacroNodes('macroId')
```

View file

@ -0,0 +1,29 @@
---
title: storeMacroIds()
---
Stores data for macro IDs generated via [`generateMacroIds()`](/reference/store-methods/generatemacroids).
## Signature
```mjs
Object store.storeMacroIds(
String id,
Array ids,
macro = store.activeMacro,
part = store.activePart,
)
```
The method takes a (macro) id and an object of ids and stores it in the store under the active macro and part.
Or, if you want to, you can pass in `macro` and `part` to not use the active macro or part.
## Example
```mjs
const ids = store.getMacroIds('macroId', ids)
```
Storing this data is a requirement to allow removal of macros.

View file

@ -0,0 +1,19 @@
---
title: unflag.error()
---
This removes a specific piece of information flagged at the `error` level.
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.error`.
When doing so, you can pass an `id` or -- if no `id` is used, the `title` field will be used as the `id`.
This methods allows you to remove this flagged info by passing said `id` (or `title`).
## Signature
```js
undefined Store.unflag.error(string id)
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).

View file

@ -0,0 +1,19 @@
---
title: unflag.fixme()
---
This removes a specific piece of information flagged at the `fixme` level.
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.fixme`.
When doing so, you can pass an `id` or -- if no `id` is used, the `title` field will be used as the `id`.
This methods allows you to remove this flagged info by passing said `id` (or `title`).
## Signature
```js
undefined Store.unflag.fixme(string id)
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).

View file

@ -0,0 +1,19 @@
---
title: unflag.info()
---
This removes a specific piece of information flagged at the `info` level.
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.info`.
When doing so, you can pass an `id` or -- if no `id` is used, the `title` field will be used as the `id`.
This methods allows you to remove this flagged info by passing said `id` (or `title`).
## Signature
```js
undefined Store.unflag.info(string id)
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).

View file

@ -0,0 +1,19 @@
---
title: unflag.note()
---
This removes a specific piece of information flagged at the `note` level.
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.note`.
When doing so, you can pass an `id` or -- if no `id` is used, the `title` field will be used as the `id`.
This methods allows you to remove this flagged info by passing said `id` (or `title`).
## Signature
```js
undefined Store.unflag.note(string id)
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).

View file

@ -0,0 +1,17 @@
---
title: unflag.preset()
---
This removes a specific piece of information flagged through the [`flag.preset()`](/reference/store-methods/flag.preset) method.
## Signature
```js
undefined Store.unflag.preset(string id)
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
See [flag.preset()](/reference/store-methods/flag.preset) for a list of available presets.
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).

View file

@ -0,0 +1,19 @@
---
title: unflag.tip()
---
This removes a specific piece of information flagged at the `tip` level.
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.tip`.
When doing so, you can pass an `id` or -- if no `id` is used, the `title` field will be used as the `id`.
This methods allows you to remove this flagged info by passing said `id` (or `title`).
## Signature
```js
undefined Store.unflag.tip(string id)
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).

View file

@ -0,0 +1,19 @@
---
title: unflag.warn()
---
This removes a specific piece of information flagged at the `warn` level.
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.warn`.
When doing so, you can pass an `id` or -- if no `id` is used, the `title` field will be used as the `id`.
This methods allows you to remove this flagged info by passing said `id` (or `title`).
## Signature
```js
undefined Store.unflag.warn(string id)
```
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).