2021-10-17 18:26:00 +02:00
|
|
|
---
|
2023-10-29 17:20:35 +01:00
|
|
|
title: cutOnFold
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-30 01:45:37 +02:00
|
|
|
The `cutonfold` macro adds a _cut on fold_ indicator to your pattern.
|
2023-10-29 17:20:35 +01:00
|
|
|
|
|
|
|
It is provided by [plugin-annotations](/reference/plugins/annotations), which is
|
|
|
|
part of [core-plugins](/reference/plugins/core) (so it is available by default).
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-30 01:45:37 +02:00
|
|
|
## Signature
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
```js
|
|
|
|
macro('cutonfold', {
|
2023-10-29 17:20:35 +01:00
|
|
|
String id="cutonfold",
|
2022-09-30 01:45:37 +02:00
|
|
|
Point from,
|
|
|
|
Boolean grainline=false,
|
|
|
|
Number margin=5,
|
|
|
|
Number offset=15,
|
|
|
|
String prefix='',
|
|
|
|
Point to,
|
2023-10-29 17:20:35 +01:00
|
|
|
Boolean force = false,
|
2022-01-18 10:13:16 +01:00
|
|
|
})
|
2021-08-25 16:09:31 +02:00
|
|
|
```
|
|
|
|
|
2022-09-30 01:45:37 +02:00
|
|
|
## Example
|
|
|
|
|
|
|
|
<Example caption="Example of the cut on fold indicator added by this macro">
|
|
|
|
```js
|
2022-12-09 20:59:53 -08:00
|
|
|
({ Point, macro, Path, paths, part }) => {
|
2022-09-30 01:45:37 +02:00
|
|
|
|
|
|
|
macro('cutonfold', {
|
|
|
|
from: new Point(0,0),
|
|
|
|
to: new Point(100,0),
|
|
|
|
grainline: true
|
|
|
|
})
|
|
|
|
|
2022-12-09 20:59:53 -08:00
|
|
|
// Prevent clipping
|
|
|
|
paths.diag = new Path()
|
|
|
|
.move(new Point(-10,-20))
|
|
|
|
.move(new Point(110,0))
|
|
|
|
|
2022-09-30 01:45:37 +02:00
|
|
|
return part
|
|
|
|
}
|
|
|
|
```
|
|
|
|
</Example>
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
2022-02-19 08:04:25 +01:00
|
|
|
| Property | Default | Type | Description |
|
2021-08-25 16:09:31 +02:00
|
|
|
|------------:|---------|---------------------|-------------|
|
2022-02-20 14:35:50 +01:00
|
|
|
| `from` | | [Point](/reference/api/point) | The startpoint of the _cut on fold_ indicator |
|
2023-10-29 17:20:35 +01:00
|
|
|
| `id` | `cutonfold` | `string` | The ID of this macro instance |
|
2022-02-20 14:35:50 +01:00
|
|
|
| `to` | | [Point](/reference/api/point) | The endpoint of the _cut on fold_ indicator |
|
2024-01-24 12:12:54 -08:00
|
|
|
| `margin` | 5 | Number | The distance in % to keep from the start/end edge |
|
2022-01-17 18:12:49 +01:00
|
|
|
| `offset` | 15 | Number | The distance in mm to offset from the line from start to end |
|
2023-05-07 09:18:19 -07:00
|
|
|
| `prefix` | 'cutonfold' | String | A prefix to apply to the names of the generated path and points |
|
2021-08-25 16:09:31 +02:00
|
|
|
| `grainline` | `false` | Boolean | Whether this cutonfold indicator is also the grainline |
|
2023-10-29 17:20:35 +01:00
|
|
|
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
|
2022-12-09 20:59:53 -08:00
|
|
|
|
2022-09-30 01:45:37 +02:00
|
|
|
## Notes
|
2021-12-27 17:33:49 +01:00
|
|
|
|
2023-10-29 17:20:35 +01:00
|
|
|
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
|
2023-05-07 10:28:26 -07:00
|
|
|
|
2022-09-30 01:45:37 +02:00
|
|
|
### It's safe to use a corner of your pattern part for this
|
2021-12-27 17:33:49 +01:00
|
|
|
|
2022-02-19 08:04:25 +01:00
|
|
|
Since this is typically used on corners, the generated cut-on-fold indicator
|
2021-12-27 17:33:49 +01:00
|
|
|
will not go all the way to the `to` and `from` points.
|
|
|
|
|