2021-10-17 18:26:00 +02:00
|
|
|
---
|
|
|
|
title: grainline
|
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-12-09 20:59:53 -08:00
|
|
|
The `grainline` macro adds a _grainline_ 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 04:39:30 +02:00
|
|
|
## Signature
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
```js
|
2022-09-30 04:39:30 +02:00
|
|
|
macro('grainline', {
|
|
|
|
Point from,
|
|
|
|
Point to,
|
|
|
|
String text=grainline,
|
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 04:39:30 +02:00
|
|
|
## Example
|
|
|
|
|
|
|
|
<Example caption="Example of the grainline indicator added by this macro">
|
|
|
|
```js
|
2022-12-09 20:59:53 -08:00
|
|
|
({ Point, macro, Path, paths, part }) => {
|
2022-09-30 04:39:30 +02:00
|
|
|
|
|
|
|
macro('grainline', {
|
|
|
|
from: new Point(0,0),
|
|
|
|
to: new Point(100,0),
|
|
|
|
})
|
|
|
|
|
2022-12-09 20:59:53 -08:00
|
|
|
// Prevent clipping
|
|
|
|
paths.diag = new Path()
|
|
|
|
.move(new Point(-20,-10))
|
|
|
|
.move(new Point(110, 0))
|
|
|
|
|
2022-09-30 04:39:30 +02:00
|
|
|
return part
|
|
|
|
}
|
|
|
|
```
|
|
|
|
</Example>
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
2022-02-19 08:04:25 +01:00
|
|
|
| Property | Default | Type | Description |
|
2022-01-18 09:20:28 +01:00
|
|
|
|------------:|-------------|------------|----------------------------------------------|
|
2022-02-20 14:35:50 +01:00
|
|
|
| `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 |
|
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-01-18 09:20:28 +01:00
|
|
|
[1]: /reference/api/point
|
2022-07-10 16:09:12 +02:00
|
|
|
|
2022-09-30 04:39:30 +02:00
|
|
|
## Notes
|
|
|
|
|
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
|
|
|
|