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-04-15 16:31:45 +02:00
|
|
|
It is provided by the [annotations plugin](/reference/plugins/annotations).
|
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,
|
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 |
|
2021-10-17 18:26:00 +02:00
|
|
|
|
2022-12-09 20:59:53 -08:00
|
|
|
## 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 |
|
|
|
|
|
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
|
|
|
|
|
|
|
|
### Removing the grainline indicator
|
2022-07-10 16:09:12 +02:00
|
|
|
|
|
|
|
If you inherit a part with a grainline indicator and you'd like to remove it,
|
|
|
|
you can do so by passing `false` to the macro:
|
|
|
|
|
|
|
|
```js
|
|
|
|
macro('grainline', false)
|
|
|
|
```
|