1
0
Fork 0
freesewing/sites/dev/docs/reference/macros/grainline
Joost De Cock ab3204f9f1 chore: Port FreeSewing.dev to docusaurus
The replaces the NextJS site powering FreeSewing.dev with a Docusaurus
setup. It's part of my efforts to simplify FreeSewing's setup so we can
focus on our core value proposition.
2024-09-28 13:13:48 +02:00
..
readme.mdx chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00

---
title: grainline
---

The `grainline` macro adds a _grainline_ indicator to your pattern.

It is provided by [plugin-annotations](/reference/plugins/annotations), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).

## Signature

```js
macro('grainline', {
  Point from,
  Point to,
  String text=grainline,
  Boolean force = false,
})
```

## Example

<Example caption="Example of the grainline indicator added by this macro">
```js
({ Point, macro, Path, paths, part }) => {

  macro('grainline', {
    from: new Point(0,0),
    to: new Point(100,0),
  })

  // Prevent clipping
  paths.diag = new Path()
    .move(new Point(-20,-10))
    .move(new Point(110, 0))

  return part
}
```
</Example>

## Configuration

| Property    | Default     | Type       | Description                                  |
|------------:|-------------|------------|----------------------------------------------|
| `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 |
| `force`      | `false`    | `boolean`  | Set this to `true` to display the macro output even when `complete` is `false` |

[1]: /reference/api/point

## Notes

This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.