1
0
Fork 0

Merge pull request #4004 from freesewing/annotations

Add documentation for three macros
This commit is contained in:
Joost De Cock 2023-05-18 08:39:55 +02:00 committed by GitHub
commit f181f1283c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 226 additions and 0 deletions

View file

@ -0,0 +1,75 @@
---
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/).
## Signature
```js
macro('crossbox', {
Point from,
Point to,
String text,
})
```
## Example
<Example caption="An example of the crossbox macro">
```js
({ 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.br = new Point(45,25)
macro('crossbox', {
from: points.tl,
to: points.br,
text: 'attach here',
})
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|----------------:|----------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The top left point of the crossbox |
| `to` | | [Point](/reference/api/point) | The bottom right point of the crossbox |
| `text` | | String | Optional text to go in the center of the crossbox |
## Result
| 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

@ -0,0 +1,70 @@
---
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/).
## Signature
```js
macro('pleat', {
Point from,
Point to,
String prefix = 'pleat',
Number margin = 35,
Boolean reverse = false,
})
```
## 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(30,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 |
| `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 |
| `reverse` | `false` | Boolean | Reverses the two pleat lines and the arrow |
## Result
| 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

@ -0,0 +1,81 @@
---
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/).
## Signature
```js
macro('sewTogether', {
Point from,
Point to,
Point middle = null,
Boolean hinge = false,
String prefix = 'sewtogether',
})
```
## 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 |
|----------------:|----------|---------------------|-------------|
| `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 |
## 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
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.