1
0
Fork 0

Merge pull request #3199 from BenJamesBen/macros-doc-updates

fix(docs): Updates to macros documentation
This commit is contained in:
Joost De Cock 2022-12-10 17:08:07 +01:00 committed by GitHub
commit d806ad4f0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 211 additions and 46 deletions

View file

@ -50,3 +50,9 @@ macro('banner', {
| `dy` | `1` | `number` | Controls how far the text will be located above the path |
| `spaces` | `12` | `number` | The number of spaces to place between repetitions |
| `repeat` | `10` | `number` | The number of repetitions |
## 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.

View file

@ -43,6 +43,12 @@ macro('banner', {
| `angle` | `0` | `number` | The angle under which to draw the bartack |
| `density` | `3` | `number` | Controls how close the stitches are togeter |
| `length` | `15` | `number` | Length of the bartack |
| `prefix` | | `string` | A prefix to apply to the names of the generated path and points |
| `suffix` | | `string` | A suffix to apply to the names of the generated path and points |
| `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 |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}bartack${suffix}` | Path generated for the bartack marker |

View file

@ -49,6 +49,12 @@ macro('banner', {
| `density` | `3` | `number` | Controls how close the stitches are togeter |
| `length` | `15` | `number` | Length of the bartack |
| `path` | | `Path` | The path the bartack should follow |
| `prefix` | | `string` | A prefix to apply to the names of the generated path and points |
| `suffix` | | `string` | A suffix to apply to the names of the generated path and points |
| `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 |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}bartack${suffix}` | Path generated for the bartack marker |

View file

@ -54,7 +54,13 @@ macro('banner', {
| `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 names of the generated path and points |
| `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 names of the generated path and points |
| `suffix` | | `string` | A suffix to apply to the name of the generated path |
| `width` | `3` | `number` | Width of the bartack |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}bartack${suffix}` | Path generated for the bartack marker |

View file

@ -22,7 +22,7 @@ macro('cutonfold', {
<Example caption="Example of the cut on fold indicator added by this macro">
```js
({ Point, macro, part }) => {
({ Point, macro, Path, paths, part }) => {
macro('cutonfold', {
from: new Point(0,0),
@ -30,6 +30,11 @@ macro('cutonfold', {
grainline: true
})
// Prevent clipping
paths.diag = new Path()
.move(new Point(-10,-20))
.move(new Point(110,0))
return part
}
```
@ -43,8 +48,19 @@ macro('cutonfold', {
| `to` | | [Point](/reference/api/point) | The endpoint of the _cut on fold_ indicator |
| `margin` | 5 | [Point](/reference/api/point) | The distance in % to keep from the start/end edge |
| `offset` | 15 | Number | The distance in mm to offset from the line from start to end |
| `prefix` | | 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 |
## Result
| Generated Element | Description |
|------|-------------|
| `paths.cutonfold${prefix}` | The Path for the _cut on fold_ indicator |
| `points.cutonfoldFrom${prefix}` | Point used to create the path |
| `points.cutonfoldVia1${prefix}` | Point used to create the path |
| `points.cutonfoldVia2${prefix}` | Point used to create the path |
| `points.cutonfoldTo${prefix}` | Point used to create the path |
## Notes
### It's safe to use a corner of your pattern part for this

View file

@ -46,4 +46,4 @@ 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)-coordinare 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

@ -2,8 +2,7 @@
title: gore
---
The `gore` macro facilitates the drafting of [gores][1] which 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/).
## Signature
@ -16,6 +15,7 @@ macro('gore', {
Number extraLength,
Boolean hidden=true,
String class='',
String prefix='',
)
```
@ -45,10 +45,22 @@ macro('gore', {
|--------------:|---------|------------|----------------------------------------------|
| `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 text to put on the _grainline_ indicator |
| `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 |
## 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\)

View file

@ -2,7 +2,7 @@
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 [grainline plugin](/reference/plugins/grainline/).
## Signature
@ -19,19 +19,23 @@ macro('grainline', {
<Example caption="Example of the grainline indicator added by this macro">
```js
({ Point, macro, part }) => {
({ 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 |
@ -40,6 +44,14 @@ macro('grainline', {
| `to` | | [Point][1] | The endpoint of the _grainline_ indicator |
| `text` | 'grainline' | string | The text to put on the _grainline_ indicator |
## 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
## Notes

View file

@ -11,7 +11,7 @@ It is provided by the [dimension plugin](/reference/plugins/dimension/).
macro('hd', {
String id,
Point from,
Boolean noEndtMarker,
Boolean noEndMarker,
Boolean noStartMarker,
String text,
Point to,
@ -43,11 +43,19 @@ macro('hd', {
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `y` | | Number | The Y-value at which to draw the dimension |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created |
| `id` | auto-assigned | String | A custom ID under which paths and points will be created |
| `text` | Horizontal distance | Number | The text to go on the dimension if not the from-to horizontal distance |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
## 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
Setting a custom ID will:

View file

@ -2,7 +2,7 @@
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 [dimension plugin](/reference/plugins/dimension/).
## Signature
@ -12,7 +12,7 @@ macro('ld', {
Number d,
String id,
Point from,
Boolean noEndtMarker,
Boolean noEndMarker,
Boolean noStartMarker,
String text,
Point to,
@ -39,14 +39,22 @@ macro('ld', {
## 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` | auto-assigned | String | A custom ID under wich paths and points will be created |
| `id` | auto-assigned | String | A custom ID under which paths and points will be created |
| `text` | Linear distance | Number | The text to go on the dimension if not the from-to linear distance |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
## 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

View file

@ -4,6 +4,8 @@ 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.
The `miniscale` macro is provided by the [scalebox plugin](/reference/plugins/scalebox).
It is the mini version of [the scalebox macro](/reference/macros/scalebox/).
@ -35,10 +37,20 @@ macro('miniscale', {
## Configuration
| Property | Default | Type | Description |
|-------------|---------|---------------------|-------------|
|------------:|---------|---------------------|-------------|
| `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on |
| `rotate` | 0 | Number | Rotation in degrees |
## 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
If you inherit a part with a miniscale on it and you'd like to remove all

View file

@ -53,7 +53,17 @@ macro('mirror', {
|-------------:|------------|------------|-------------|
| `mirror` | | `array` | Array with 2 [Point](/reference/api/point) objects that define the _mirror line_ |
| `clone` | `true` | `bool` | Whether to clone mirrored points and or paths |
| `points` | | `array` | An array of [Point](/reference/api/point) objects |
| `paths` | | `array` | An array of [Path](/reference/api/path) objects |
| `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 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

@ -13,7 +13,7 @@ macro('pd', {
Number d,
String id,
Path path,
Boolean noEndtMarker,
Boolean noEndMarker,
Boolean noStartMarker,
String text,
})
@ -44,12 +44,20 @@ macro('pd', {
| Property | Default | Type | Description |
|----------------:|---------|---------------------|-------------|
| `path` | | [Path](/reference/api/path) | The path to draw the dimension along |
| `d` | 0 | 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 |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created |
| `id` | auto-assigned | String | A custom ID under which paths and points will be created |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
## 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
Setting a custom ID will:

View file

@ -2,7 +2,7 @@
title: round
---
The `round` macro rounds a corner. It is provided by the [round
The `round` macro creates a rounded corner. It is provided by the [round
plugin](/reference/plugins/round/).
## Signature
@ -44,12 +44,22 @@ macro('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 |
| `via` | | [Point](/reference/api/point) | The corner to round |
| `radius` | Maximum | Number | The radius in mm in not the maximum |
| `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 |
## 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
This macro is only intended for 90 degree corners.

View file

@ -4,6 +4,8 @@ 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.
The `scalebox` macro is provided by the [scalebox
plugin](/reference/plugins/scalebox).
@ -40,7 +42,7 @@ macro('scalebox', {
## Configuration
| Property | Default | Type | Description |
|-------------|---------|---------------------|-------------|
|------------:|---------|---------------------|-------------|
| `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on |
| `lead` | FreeSewing | String | The lead text above the title |
| `title` | _pattern name + version_ | String | The title text |
@ -49,6 +51,19 @@ macro('scalebox', {
(\*) `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
### Removing the scalebox

View file

@ -2,8 +2,8 @@
title: sprinkle
---
The `sprinkle` macro facilitates adding snippets to your pattern in bulk.
It is by the [sprinkle plugin](/reference/plugins/sprinkle).
The `sprinkle` macro facilitates adding snippets to your pattern in bulk.
It is provided by the [sprinkle plugin](/reference/plugins/sprinkle).
## Signature
@ -38,7 +38,7 @@ macro('sprinkle', {
// Prevent clipping
paths.diag = new Path()
.move(points.a)
.move(points.g)
.move(new Point(points.g.x, points.g.y + 5))
return part
}
@ -49,7 +49,13 @@ macro('sprinkle', {
| Property | Default | Type | Description |
|------------:|---------|------------------|-------------|
| `snippet` | | String | Name of the snippet to sprinkle |
| `on` | `[]` | Array of strings | An array with **the names** of points to add the snippet on |
| `scale` | 1 | number | Scale for the individual snippets |
| `rotate` | 0 | number | Rotation for the individual snippets |
| `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 |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `snippets.${pointname}-${snippet}` | The Snippet(s) created |

View file

@ -2,7 +2,7 @@
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 [title plugin](/reference/plugins/title).
## Signature
@ -25,9 +25,10 @@ macro('title', {
```js
({ Point, Path, paths, macro, store, part }) => {
// This is where name/version is supposed to be stored
// 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', 'Person')
macro('title', {
nr: 9,
@ -37,8 +38,8 @@ macro('title', {
// Prevent clipping
paths.diag = new Path()
.move(new Point(0,-50))
.move(new Point(80,20))
.move(new Point(-20,-50))
.move(new Point(80,35))
return part
}
@ -56,3 +57,13 @@ 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 |
| `rotation` | 0 | Number | An optional rotation in degrees |
| `scale` | 1 | Number | An optional scaling factor |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `points._${prefix}_titleNr` | Point anchoring the part number text |
| `points._${prefix}_titleName` | Point anchoring the part name text |
| `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

@ -2,7 +2,7 @@
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 [dimension plugin](/reference/plugins/dimension/).
## Signature
@ -11,7 +11,7 @@ It is provided by the [dimension plugin](/reference/plugins/dimension/).
macro('vd', {
String id,
Point from,
Boolean noEndtMarker,
Boolean noEndMarker,
Boolean noStartMarker,
String text,
Point to,
@ -23,7 +23,7 @@ macro('vd', {
<Example caption="An example of a vertical dimension with the vd macro">
```js
({ Point, macro, part }) => {
({ Point, macro, Path, paths, part }) => {
macro('vd', {
from: new Point(0,0),
@ -31,6 +31,11 @@ macro('vd', {
x:10,
})
// Prevent clipping
paths.diag = new Path()
.move(new Point(-20,0))
.move(new Point(90,40))
return part
}
```
@ -44,10 +49,18 @@ macro('vd', {
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `x` | | Number | The X-value at which to draw the dimension |
| `text` | Vertical distance | Number | The text to go on the dimension if not the from-to vertical distance |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created |
| `id` | auto-assigned | String | A custom ID under which paths and points will be created |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
## 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
Setting a custom ID will: