first
This commit is contained in:
parent
51df867e6e
commit
4184e31ff7
3 changed files with 125 additions and 3 deletions
75
markdown/dev/reference/macros/crossbox/en.md
Normal file
75
markdown/dev/reference/macros/crossbox/en.md
Normal 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 | The text to go on the dimension if not the from-to horizontal distance |
|
||||
|
||||
## 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 |
|
47
markdown/dev/reference/macros/pleat/en.md
Normal file
47
markdown/dev/reference/macros/pleat/en.md
Normal file
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
title: pleat
|
||||
---
|
||||
|
||||
The `pleat` macro is used to mark a sewing pattern to attach and reinforce
|
||||
and 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('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)
|
||||
|
||||
points.from = new Point(30,0)
|
||||
points.t0 = new Point(40,0)
|
||||
|
||||
macro('pleat', {
|
||||
from: points.from,
|
||||
to: points.to,
|
||||
})
|
||||
|
||||
return part
|
||||
}
|
||||
```
|
||||
</Example>
|
|
@ -1,8 +1,8 @@
|
|||
// Export macros
|
||||
export const crossboxMacros = {
|
||||
crossbox: function (so, { points, Point, paths, Path, getId }) {
|
||||
let id = getId()
|
||||
let shiftFraction = 0.1
|
||||
const id = getId()
|
||||
const shiftFraction = 0.1
|
||||
points[id + '_boxTopLeft'] = so.from.copy()
|
||||
points[id + '_boxBottomRight'] = so.to.copy()
|
||||
points[id + '_boxTopRight'] = new Point(so.to.x, so.from.y)
|
||||
|
@ -44,7 +44,7 @@ export const crossboxMacros = {
|
|||
.line(points[id + '_topCrossBL'])
|
||||
.attr('class', 'lining dotted stroke-sm')
|
||||
if (typeof so.text === 'string') {
|
||||
points.textAnchor = points[id + '_boxTopLeft']
|
||||
points[id + '_textAnchor'] = points[id + '_boxTopLeft']
|
||||
.shiftFractionTowards(points[id + '_boxBottomRight'], 0.5)
|
||||
.attr('data-text', so.text)
|
||||
.attr('data-text-class', 'center')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue