1
0
Fork 0

chore: Port FreeSewing.dev to docusaurus

The replaces the NextJS site powering FreeSewing.dev with a Docusaurus
setup. It's part of my efforts to simplify FreeSewing's setup so we can
focus on our core value proposition.
This commit is contained in:
Joost De Cock 2024-09-28 13:13:48 +02:00
parent 497633d1d3
commit ab3204f9f1
692 changed files with 11037 additions and 20674 deletions

View file

@ -0,0 +1,69 @@
---
title: banner
---
The `banner` macro allows you to add repeating text along a path.
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('banner', {
String id='banner',
String className='',
Number dy=1,
Number repeat=10,
Number spaces=12,
Path path,
String text,
Boolean force = false,
})
```
## Example
<Example caption="Example of the banner macro">
```js
({ Point, points, Path, paths, macro, part }) => {
points.from = new Point(0,0)
points.to = new Point(320,0)
paths.banner = new Path()
.move(points.from)
.line(points.to)
.move(new Point(0,-10)) // Prevent clipping
macro('banner', {
path: paths.banner,
text: 'banner',
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|-------------:|------------|------------|-------------|
| `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 |
| `id` | `banner` | `string` | The id of this macro instance |
| `path` | | `Path` | The Path to add the text on |
| `repeat` | `10` | `number` | The number of repetitions |
| `spaces` | `12` | `number` | The number of spaces to place between repetitions |
| `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
Under the hood, this macro will:
- 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

@ -0,0 +1,81 @@
---
title: bannerBox
---
The `bannerbox` macro allows you to add a box with repeating text on it.
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('bannerbox', {
String id='bannerbox',
String textClassName='text-xs fill-note',
String boxClassName='stroke-xs stroke-note lashed',
Point topLeft=new Point(0,0),
Point bottomRight=new Point(100,100),
String text='',
Number margin=15,
Number dy=4,
Number repeat=99,
Number spaces=12,
Boolean force = false,
})
```
## Example
<Example caption="Example of the bannerbox macro">
```js
({ Point, points, Path, paths, macro, part }) => {
macro('bannerbox', {
text: 'a bannerbox example',
topLeft: new Point(0,0),
bottomRight: new Point(80, 30)
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|----------------:|--------------------------------|----------|-------------|
| `bottomRight` | `new Point(100,100)` | `Point` | Top top-left corner of the box |
| `boxClassName` | `stroke-xs stroke-note lashed` | `string` | CSS classes to apply to the box 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] |
| `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
Under the hood, this macro will [the banner macro][banner] to place the text on the box path.
The banner box will be larger than the box formed by the coordinates
provided to the macro,
The sides will be offset by approximately 1.4 times the `margin`.
If the total length of the text (based on `text`, `repeat`, and `spaces`)
is less than the length of the box path, the text will simply end,
leaving some of the box without text.
If the total length of text is greater than the length of the box path,
the remaining text will be truncated.
For this reason, using a `repeat` value greater than what is normally
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
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

View file

@ -0,0 +1,60 @@
---
title: bartack
---
The `bartack` macro allows you to add a _bartack_ marker to your sewing
pattern.
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('banner', {
String id='bartack',
Point anchor,
Number angle=0,
Number density=3,
Number length=15,
String prefix='',
String suffix='',
Number width=3,
Boolean force = false,
})
```
## Example
<Example caption="Example of the bartack macro">
```js
({ macro, Point, part }) => {
macro('bartack', {
anchor: new Point(0,0),
length: 25
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|-------------:|------------|------------|-------------|
| `anchor` | | `Point` | The point to start the bartack from |
| `angle` | `0` | `number` | The angle under which to draw the bartack |
| `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 |
| `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 |
| `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`.

View file

@ -0,0 +1,66 @@
---
title: bartackAlong
---
The `bartackAlong` macro allows you to add a _bartack_ marker to your sewing pattern.
More specifically, a bartack along a path.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('bartackAlong', {
String id='bartack'
Number angle=0,
Number density=3,
Number length=15,
Path path,
String prefix='',
String suffix='',
Number width=3,
Boolean force = false,
})
```
## Example
<Example caption="Example of the bartackAlong macro">
```js
({ Point, Path, macro, part }) => {
macro('bartackAlong', {
path: new Path()
.move(new Point(15,15))
.curve(
new Point(20, 20),
new Point(30, 20),
new Point(35, 15),
)
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|-------------:|------------|------------|-------------|
| `angle` | `0` | `number` | The angle under which to draw the bartack |
| `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 |
| `path` | | `Path` | The path the bartack should follow |
| `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 |
| `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`.

View file

@ -0,0 +1,69 @@
---
title: bartackFractionAlong
---
The `bartackFractionAlong` macro allows you to add a _bartack_ marker to your
sewing pattern. More specifically, a bartack along a fraction of a path.
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('bartackFractionAlong', {
String id="bartack",
Number angle=0,
Number density=3,
Number end=1,
Number length=15,
Path path,
String prefix='',
Number start=0,
String suffix='',
Number width=3,
Boolean force = false,
})
```
## Example
<Example caption="Example of the bartackFractionAlong macro">
```js
({ Point, Path, macro, part }) => {
macro('bartackFractionAlong', {
path: new Path()
.move(new Point(15,15))
.curve(
new Point(20, 20),
new Point(30, 20),
new Point(35, 15),
),
start: 0.2,
end: 0.8,
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|-------------:|------------|------------|-------------|
| `angle` | `0` | `number` | The angle under which to draw the bartack |
| `density` | `3` | `number` | Controls how close the stitches are together |
| `end` | `1` | `number` | At which fraction of the path length (from `0` to `1`) should the bartack end |
| `length` | `15` | `number` | Length of the bartack |
| `path` | | `Path` | The path the bartack should follow |
| `prefix` | | `string` | A prefix to apply to the name of the generated path |
| `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 |
| `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`.

View file

@ -0,0 +1,57 @@
---
title: crossBox
---
The `crossbox` macro is used to mark a feature on a sewing pattern
to attach and reinforce an attachment between two 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.
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('crossbox', {
String id='crossbox',
Point topLeft,
Point bottomRight,
String text,
Boolean force = false,
})
```
## Example
<Example caption="An example of the crossbox macro">
```js
({ Point, points, Path, paths, macro, part }) => {
points.tl = new Point(5,5)
points.br = new Point(45,25)
macro('crossbox', {
topLeft: new Point(5, 5),
bottomRight: new Point(45, 25),
text: 'Attach here',
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|----------------:|----------|---------------------|-------------|
| `bottomRight` | | [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 |
| `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`.

View file

@ -0,0 +1,68 @@
---
title: cutOnFold
---
The `cutonfold` macro adds a _cut on fold_ indicator to your pattern.
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('cutonfold', {
String id="cutonfold",
Point from,
Boolean grainline=false,
Number margin=5,
Number offset=15,
String prefix='',
Point to,
Boolean force = false,
})
```
## Example
<Example caption="Example of the cut on fold indicator added by this macro">
```js
({ Point, macro, Path, paths, part }) => {
macro('cutonfold', {
from: new Point(0,0),
to: new Point(100,0),
grainline: true
})
// Prevent clipping
paths.diag = new Path()
.move(new Point(-10,-20))
.move(new Point(110,0))
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|------------:|---------|---------------------|-------------|
| `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 |
| `margin` | 5 | Number | 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 |
| `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 |
| `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`.
### It's safe to use a corner of your pattern part for this
Since this is typically used on corners, the generated cut-on-fold indicator
will not go all the way to the `to` and `from` points.

View file

@ -0,0 +1,58 @@
---
title: flip
---
The `flip` macro flips (mirrors) an entire part vertically around either the
X-axis or the Y-axis.
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.
:::
## Signature
```js
macro('flip', { String axis=x })
```
## Example
<Example caption="Example of the flip macro">
```js
({ Point, points, Path, paths, Snippet, snippets, macro, part }) => {
points.a = new Point(0,0)
points.b = new Point(90,20)
paths.a = new Path().move(points.a).line(points.b).setClass('dotted note')
snippets.a = new Snippet(
'logo',
paths.a.shiftFractionAlong(0.5)
).attr('data-scale', 0.2)
macro('flip')
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|----------------:|---------|---------------------|-------------|
| `axis` | 'x' | The axis to flip around. Either `x` or `y` |
## Notes
Under the hood, this macro will:
- Go through all Points in your Part, and multiply their (X or Y)-coordinate by -1
- Go through all the Paths in your Part, and for each drawing operation will multiply the (X or Y)-coordinate by -1
- Go through all the Snippets in your Part and multiply the (X or Y)-coordinate of the anchor point by -1
- Add a 'flipped` Attribute to Points and Paths to keep track of the number of times they have been flipped (to avoid issues when multiple flips are performed)

View file

@ -0,0 +1,63 @@
---
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.
:::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.
:::
## Signature
```js
macro('gore', {
Point from,
Number radius,
Number gores,
Number extraLength,
Boolean hidden=true,
String class='',
String prefix='',
)
```
## Example
<Example caption="Example of the gore macro">
```js
({ Point, macro, part }) => {
macro('gore', {
from: new Point(0,0),
radius: 100,
gores: 6,
extraLength: 20,
hidden: false,
class: 'fabric',
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|--------------:|---------|------------|----------------------------------------------|
| `from` | | [Point][2] | The point to start drafting the gore from |
| `radius` | | number | The radius of the sphere the gores should cover |
| `gores` | | number | The number of gores into which the sphere is divided |
| `extraLength` | | number | The length of the straight section after a complete semisphere |
| `hidden` | `true` | boolean | Whether or not to hide 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 |
[1]: https://en.wikipedia.org/wiki/Gore_\(segment\)
[2]: /reference/api/point

View file

@ -0,0 +1,56 @@
---
title: grainline
---
The `grainline` macro adds a _grainline_ indicator to your pattern.
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('grainline', {
Point from,
Point to,
String text=grainline,
Boolean force = false,
})
```
## Example
<Example caption="Example of the grainline indicator added by this macro">
```js
({ Point, macro, Path, paths, part }) => {
macro('grainline', {
from: new Point(0,0),
to: new Point(100,0),
})
// Prevent clipping
paths.diag = new Path()
.move(new Point(-20,-10))
.move(new Point(110, 0))
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|------------:|-------------|------------|----------------------------------------------|
| `from` | | [Point][1] | The startpoint of the _grainline_ indicator |
| `to` | | [Point][1] | The endpoint of 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` |
[1]: /reference/api/point
## Notes
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.

View file

@ -0,0 +1,59 @@
---
title: hd
---
The `hd` macro adds a _horizontal dimension_ to your pattern.
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('hd', {
String id = 'hd',
Point from,
Boolean noEndMarker,
Boolean noStartMarker,
String text,
Point to,
Number y,
Boolean force = false,
})
```
## Example
<Example caption="An example of a horizontal dimension with the hd macro">
```js
({ Point, macro, part }) => {
macro('hd', {
from: new Point(0,0),
to: new Point(100,0),
y: 15,
force: 1,
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|----------------:|----------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `y` | | Number | The Y-value at which to draw the dimension |
| `id` | `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 |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start 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` |
## Notes
This macro takes the `paperless` setting into account and won't output anything when both `paperless` and `force` are `false`.

View file

@ -0,0 +1,58 @@
---
title: ld
---
The `ld` macro adds a _linear dimension_ to your pattern.
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('ld', {
Number d,
String id = 'ld',
Point from,
Boolean noEndMarker,
Boolean noStartMarker,
String text,
Point to,
Boolean force = false,
})
```
## Example
<Example caption="An example of a linear dimension with the ld macro">
```js
({ Point, macro, part }) => {
macro('ld', {
from: new Point(0,0),
to: new Point(100,20),
d:15,
force: true,
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|----------------:|---------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `d` | 0 | Number | The offset at which to draw the dimension |
| `id` | `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 |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start 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` |
## Notes
This macro takes the `paperless` setting into account and won't output anything when both `paperless` and `force` are `false`.

View file

@ -0,0 +1,50 @@
---
title: miniScale
---
The `miniscale` macro adds a mini _scale box_ to your pattern. This box allows
users to verify their pattern is printed to scale.
The white inside of the box provides a metric scale, and the black outside
of the box provides an imperial scale.
A miniscale 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
```js
macro('miniscale', {
Point at,
Number rotate,
Boolean force = false,
})
```
## Example
<Example caption="An example of the miniscale macro">
```js
({ Point, macro, part }) => {
macro('miniscale', {
at: new Point(0,0),
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|------------:|---------|---------------------|-------------|
| `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on |
| `rotate` | 0 | Number | Rotation in degrees |
| `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`.

View file

@ -0,0 +1,65 @@
---
title: mirror
---
The `mirror` macro allows you to mirror points and/or paths around a mirror line.
It is provided by the [mirror plugin](/reference/plugins/mirror/), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).
## Signature
```js
macro('mirror', {
Boolean clone,
Array mirror,
Function nameFormat,
Array paths,
Array points,
String prefix,
})
```
## Example
<Example caption="An example of the mirror macro">
```js
({ Point, points, Path, paths, macro, part }) => {
points.from = new Point(0,0)
points.cp1 = new Point(10,20)
points.cp2 = new Point(60,20)
points.to = new Point(70,0)
paths.example = new Path()
.move(points.from)
.curve(points.cp1, points.cp2, points.to)
points.m1 = new Point(20,0)
points.m2 = new Point(20,20)
paths.mirror = new Path()
.move(points.m1)
.line(points.m2)
.addClass('stroke-xm dashed stroke-lining')
macro('mirror', {
clone: true,
mirror: [ points.m1, points.m2 ],
paths: Object.keys(paths),
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|-------------:|------------|------------|-------------|
| `mirror` | | `array` | Array with 2 [Point](/reference/api/point) objects that define the _mirror line_ |
| `clone` | `true` | `bool` | Whether to clone mirrored points and or paths |
| `points` | | `array` | An array of pointnames, the names of Points in the `points` array to mirror |
| `paths` | | `array` | An array of pathnames, the names of Paths in the `paths` array to mirror |
| `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 |

View file

@ -0,0 +1,61 @@
---
title: pd
---
The `pd` macro adds a _path dimension_ to your pattern, indicating the length
of a path.
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('pd', {
Number d,
String id,
Path path,
Boolean noEndMarker,
Boolean noStartMarker,
String text,
Boolean force = false,
})
```
## Example
<Example caption="An example of a path dimension with the pd macro">
```js
({ Point, Path, paths, macro, part }) => {
paths.example = new Path()
.move(new Point(0,0))
.curve(new Point(20,10), new Point(60,10), new Point(80,0))
macro('pd', {
path: paths.example,
d: 15,
force: true,
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|----------------:|---------|---------------------|-------------|
| `path` | | [Path](/reference/api/path) | The path to draw the dimension along |
| `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 |
| `id` | `pd` | `string` | The ID of this macro instance |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start 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` |
## Notes
This macro takes the `paperless` setting into account and won't output anything when both `paperless` and `force` are `false`.

View file

@ -0,0 +1,75 @@
---
title: pleat
---
The `pleat` macro is used to mark a pleat on a pattern. It draws the appropriate
lines perpendicular to the line going from `from` to `to`.
The `pleat` macro follows the convention of paths being counter-clockwise to
determine what is the inside or outside of the part.
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('pleat', {
String id = 'pleat',
Point from,
Point to,
Number margin = 35,
Boolean reverse = false,
Boolean force = false,
Object calsses = {
arrow: 'note',
from: 'note',
to: 'note dashed',
},
})
```
## Example
<Example caption="An example of the pleat macro">
```js
({ Point, points, Path, paths, macro, part }) => {
points.seamTL = new Point(0,0)
points.seamTR = new Point(70,0)
paths.seam = new Path()
.move(points.seamTL)
.line(points.seamTR)
.attr('class', 'fabric')
points.from = new Point(40,0)
points.to = new Point(10,0)
macro('pleat', {
from: points.from,
to: points.to,
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|----------------:|----------|---------------------|-------------|
| `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 |
| `margin` | 35 | Number | The size (in mm) of the pleat lines |
| `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 |
## Notes
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.

View file

@ -0,0 +1,78 @@
---
title: Macros
---
Macros are a way to combine different operations into a single command.
Macros are typically provided by by plugins, but can also be added ad-hoc
without the need for a plugin.
## Signature
```js
null macro(object config, object props)
```
A macro receives a single configuration object as its first parameter.
The second parameter is the same object received by [the draft method in a
part](/reference/api/part/draft)
## Example
```js
pattern.use({
name: 'My adhoc plugin',
macros: {
myMacro: function (so, props) {
// Do something wonderful here
},
myOtherMacro: function (so, props) {
// Do something wonderful here
},
}
}
```
Now you can use these macros in your part:
```js
({ macro, part }) => {
macro('myMacro', {
some: [ 'config', 'here' ],
more: 'config'
})
macro('myOtherMacro', 'Just a string')
return part
}
```
## Removing macros and the role of the macro id
Many macros accept an `id` parameter as part of their configuration. This `id`
is used to generate the names for paths, points, or snippets that are added to
the part by the macro. This way, macro-added content is deterministic, and can
be removed again.
Each macro typically has an `rm`-prefixed counterpart that removes the (changed
done by) the macro. For example, you can add a bartack with the `bartack`
macro, and it can be removed with the `rmbartack` macro. For this removal to
work, and id must be set in the macro, and it must be passed when removing the
macro.
For macros that are typically used once per part (such as the `title` macro)
you can rely on the default id. For macros typically used multiple times (such
as the various dimension macros) you should set an id that is unique within the
part for each invocation.
## Macros we maintain
Below is a list of macros from [the plugins we maintain](/reference/plugins).
:::note
We use camelCase here, but macro names are case-insensitive
:::
<ReadMore />

View file

@ -0,0 +1,83 @@
---
title: ringSector
---
The `ringsector` macro drafts a ring sector, which is like a part of a donut
with an inside and outside radius. It is particularly useful for drafting
curved waistbands, circle skirts, and so on.
It is provided by the [ringsector plugin](/reference/plugins/ringsector).
:::note
##### Not a core-plugins macro
The `ringsector` macro is not provided by the [core-plugins](/reference/plugins/core),
so you need to load the [ringsector plugin](/reference/plugins/ringsector) explicitly
if you want to use it.
:::
## Signature
```js
macro('ringsector', {
String id='ringsector',
Point center = new Point(0,0),
Number angle,
Number insideRadius,
Number outsideRadius,
Boolean rotate = false,
})
```
## Example
<Example caption="Example of a ring sector drafted by this macro">
```js
({ Point, macro, Path, paths, part }) => {
macro('ringsector', {
angle: 60,
insideRadius: 30,
outsideRadius: 45,
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|---------------:|-------------------|------------|-------------|
| `id` | `ringsector` | String | The id to use in auto-generate macro points and paths |
| `center` | `new Point(0,0)` | [Point][1] | The center point of the ring sector |
| `angle` | | Number | The angle the ring sector should cover |
| `insideRadius` | | Number | The inside radius of the ring sector |
| `outsideRadius` | | Number | The outside radius of the ring sector |
| `rotate` | `false` | Boolean | Whether or not to rotate the ringsector so one of its sides is vertical (see [example below](#example-when-rotatetrue)) |
[1]: /reference/api/point
## Notes
The `ringsector` macro creates a `path` that can be used as a seam path for a part. If doing so, the left side of the path assumes a `cutOnFold`, as the `sa` is not offset here like it is along the rest of the `path`.
### Example when rotate=true
<Example caption="Example of a ring sector drafted by this macro when rotate is truthy">
```js
({ Point, macro, Path, paths, part }) => {
macro('ringsector', {
angle: 60,
insideRadius: 30,
outsideRadius: 45,
rotate: true,
})
return part
}
```
</Example>

View file

@ -0,0 +1,14 @@
---
title: rmaD
---
The `rmad` macro removes all dimensions (all nodes created by `hd`, `vd`, `ld`, and `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('rmad')
```

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,15 @@
---
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,15 @@
---
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

@ -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

@ -0,0 +1,23 @@
---
title: rmRingSector
---
The `rmringsector` macro removes the nodes added by [the ringsector macro](/reference/macros/ringsector).
It is the recommended way to remove (the effects of) a `ringsector` macro.
It is provided by the [ringsector plugin](/reference/plugins/ringsector).
:::note
##### Not a core-plugins macro
The `rmringsector` macro is not provided by the [core-plugins](/reference/plugins/core),
so you need to load the [ringsector plugin](/reference/plugins/ringsector) explicitly
if you want to use it.
:::
## Signature
```js
macro('rmringsector', String id = '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

@ -0,0 +1,60 @@
---
title: round
---
The `round` macro creates a rounded corner.
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
```js
macro('round', {
String id = 'round',
String class,
Point from,
Boolean hide,
String prefix,
Number radius,
Point to,
Point via,
})
```
## Example
<Example caption="An example of the round macro">
```js
({ Point, points, macro, part }) => {
macro('round', {
from: new Point(0, 0),
to: new Point(100, 40),
via: new Point(100, 0),
radius: 30,
hide: false,
})
return part
}
```
</Example>
## Configuration
| 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 |
| `to` | | [Point](/reference/api/point) | The endpoint away from the corner to round |
| `via` | | [Point](/reference/api/point) | The cornerpoint to round |
| `radius` | Maximum | Number | The radius in mm if not the maximum possible |
| `prefix` | | String | A prefix to give to the points and paths 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 |
## Notes
This macro is only intended for 90 degree corners.

View file

@ -0,0 +1,60 @@
---
title: scalebox
---
The `scalebox` macro adds a _scale box_ to your pattern. This box allows users
to verify their pattern is printed to scale.
The white inside of the box provides a metric scale, and the black outside
of the box provides an imperial scale.
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('scalebox', {
String id = 'scalebox',
Point at,
String lead,
Number rotate,
String text,
String title,
Boolean force = false,
})
```
## Example
<Example caption="An example of the scalebox macro">
```js
({ Point, macro, part }) => {
macro('scalebox', {
at: new Point(0,0),
title: 'This is the title',
number: 666,
})
return part
}
```
</Example>
## Configuration
| 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 |
| `lead` | FreeSewing | String | The lead text above the title |
| `title` | _pattern name + version_ | String | The title text |
| `text` | (\*) | String | The text below the title |
| `rotate` | 0 | Number | Rotation in degrees |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
(\*) `freesewingIsMadeByJoostDeCockAndContributors \n withTheFinancialSupportOfOurPatrons`
## Notes
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.

View file

@ -0,0 +1,75 @@
---
title: sewTogether
---
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.
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('sewTogether', {
String id = 'sewtogether',
Point from,
Point to,
Point middle = null,
Boolean hinge = false,
String prefix = 'sewtogether',
Boolean force = false,
})
```
## Example
<Example caption="An example of the sewtogether macro">
```js
({ Point, points, Path, paths, macro, part }) => {
points.seamTL = new Point(0,0)
points.seamM = new Point(30,-10)
points.seamTR = new Point(60,0)
paths.seam = new Path()
.move(points.seamTL)
.line(points.seamM)
.line(points.seamTR)
.attr('class', 'fabric')
points.from = new Point(45,-5)
points.to = new Point(15,-5)
points.middle = points.seamM.copy()
macro('sewTogether', {
from: points.from,
to: points.to,
middle: points.middle,
hinge: true,
})
return part
}
```
</Example>
## Configuration
| 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 |
| `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`) |
| `prefix` | 'sewtogether' | String | The prefix to be used for creating all the points and paths |
| `hinge ` | `false` | Boolean | Draws the hinge line |
| `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`.
This macro is aware of the `sa` setting. Normally it draws the
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
outside, up to the `sa` line.

View file

@ -0,0 +1,58 @@
---
title: sprinkle
---
The `sprinkle` macro facilitates adding snippets to your pattern in bulk.
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
```js
macro('sprinkle', {
Array on,
Number scale,
Snippet snippet,
Number rotation,
})
```
## Example
<Example caption="An example of the sprinkle macro">
```js
({ Point, points, Path, paths, macro, part }) => {
points.a = new Point(0,0)
points.b = new Point(10,5)
points.c = new Point(20,0)
points.d = new Point(30,5)
points.e = new Point(40,0)
points.f = new Point(50,5)
points.g = new Point(60,0)
macro('sprinkle', {
snippet: 'button',
on: ['a', 'b', 'c', 'd', 'e', 'f', 'g']
})
// Prevent clipping
paths.diag = new Path()
.move(points.a)
.move(new Point(points.g.x, points.g.y + 5))
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|------------:|---------|------------------|-------------|
| `snippet` | | String | Name of the Snippet to sprinkle |
| `on` | `[]` | Array of strings | Array of pointnames, the names of Points in the `points` array to add the Snippets on |
| `scale` | 1 | number | Scale for the individual Snippets |
| `rotate` | 0 | number | Rotation for the individual Snippets |

View file

@ -0,0 +1,104 @@
---
title: title
---
The `title` macro adds a title to a pattern part.
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('title', {
String align = 'left',
Boolean append = false,
Point at,
String brand = 'FreeSewing',
Boolean cutlist = true,
Number dy = 8,
Boolean force = false,
String id = 'title',
Mixed notes = false,
String nr,
Number rotation = 0,
Number scale = 1,
String title = 'plugin-annotations:noName',
classes = {
String date: 'text-sm fill-current',
String name: 'fill-note',
String notes: 'text-md fill-current',
String nr: 'text-4xl fill-note font-bold',
String title: 'text-lg fill-current font-bold',
}
})
```
## Example
<Example caption="An example of the title macro">
```js
({ Point, Path, paths, macro, store, part }) => {
// This is where name/version/etc. is supposed to be stored
store.set('data.version', 3)
store.set('data.name', 'Example')
store.set('data.for', 'Sorcha')
macro('title', {
nr: 8,
title: 'The Title',
at: new Point(0,0),
brand: 'Bazooka Crew',
notes: [
"You can use any brand you want",
"\n",
"but if you plan to contribute your",
"\n",
"design, you should use the default",
"\n",
"(btw: These are the notes)"
]
})
// Prevent clipping
paths.diag = new Path()
.move(new Point(-20,-50))
.move(new Point(120,55))
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
| ----------:| :-----: | ------------------- | ----------- |
| `align` | `left` | String | Horizontal text alignment. One of `left`, `right`, or `center` |
| `append` | `false` | Boolean | Set this to `true` to append the `nr`, rather than overwrite it |
| `at` | | [Point](/reference/api/point) | The point at which to insert the title |
| `brand` | `FreeSewing` | String | Brand name will prefix the design name |
| `classes.date` | `text-sm fill-current` | String | CSS classes for the date |
| `classes.name` | `fill-note` | String | CSS classes for the name |
| `classes.notes` | `text-md fill-current` | String | CSS classes for the notes |
| `classes.nr` | `text-4xl fill-note font-bold` | String | CSS classes for the nr |
| `classes.title` | `text-lg fill-current font-bold` | String | CSS classes for the title |
| `cutlist` | `true` | Boolean | Set this to `true` to prepend notes with the cutting instructions |
| `dy` | `8` | Number | SVG-equivalent of line height, controls the vertical spacing between text lines |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
| `id` | `title` | `string` | The ID of this macro instance. See [Removing macros and the role of the macro id](/reference/macros#removing-macros-and-the-role-of-the-macro-id) |
| `notes` | | String or Array | Any notes to go under the title |
| `nr` | | String | The number of the pattern part |
| `rotation` | `0` | Number | Rotation in degrees |
| `scale` | 1 | Number | An optional scaling factor to make the title bigger/smaller |
| `title` | `plugin-annotations:noName` | String | The name of the pattern part |
| `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.|
## Notes
- This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
- This macro will check the value of `store.version` and `store.name` for the design version and name. These are auto-set by core.
- This macro will check the value of `store.for` for info of who this pattern was generated for. This is something to be done at run-time by your frontend.
- The `notes` property can be a string or an array of strings.

View file

@ -0,0 +1,63 @@
---
title: vd
---
The `vd` macro adds a _vertical dimension_ to your pattern.
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('vd', {
String id = 'vd',
Point from,
Boolean noEndMarker,
Boolean noStartMarker,
String text,
Point to,
Number x,
Boolean force = false,
})
```
## Example
<Example caption="An example of a vertical dimension with the vd macro">
```js
({ Point, macro, Path, paths, part }) => {
macro('vd', {
from: new Point(0,0),
to: new Point(0,40),
x:10,
force: true,
})
// Prevent clipping
paths.diag = new Path()
.move(new Point(-20,0))
.move(new Point(90,40))
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|----------------:|---------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `x` | | Number | The X-value at which to draw the dimension |
| `text` | Vertical distance | Number | The text to go on the dimension if not the from-to vertical distance |
| `id` | `vd` | `string` | The ID of this macro instance |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start 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` |
## Notes
This macro takes the `paperless` setting into account and won't output anything when both `paperless` and `force` are `false`.