2021-10-17 18:26:00 +02:00
---
title: title
---
2021-08-25 16:09:31 +02:00
2022-12-09 20:59:53 -08:00
The `title` macro adds a title to a pattern part.
2021-08-25 16:09:31 +02:00
It is provided by the [title plugin ](/reference/plugins/title ).
2022-09-30 04:39:30 +02:00
## Signature
```js
macro('title', {
Boolean append,
Point at,
2023-03-09 17:45:10 -06:00
Boolean cutlist
2022-09-30 04:39:30 +02:00
String nr,
String prefix,
Number rotation,
Number scale,
String title,
})
```
## Example
< Example caption = "An example of the title macro" >
```js
({ Point, Path, paths, macro, store, part }) => {
2022-12-09 20:59:53 -08:00
// This is where name/version/etc. is supposed to be stored
2022-09-30 04:39:30 +02:00
store.set('data.version', 3)
store.set('data.name', 'Example')
2022-12-09 20:59:53 -08:00
store.set('data.for', 'Person')
2022-09-30 04:39:30 +02:00
macro('title', {
nr: 9,
title: 'The title',
at: new Point(0,0)
})
// Prevent clipping
paths.diag = new Path()
2022-12-09 20:59:53 -08:00
.move(new Point(-20,-50))
.move(new Point(80,35))
2022-09-30 04:39:30 +02:00
return part
}
```
< / Example >
## Configuration
2021-08-25 16:09:31 +02:00
2022-02-19 08:04:25 +01:00
| Property | Default | Type | Description |
2022-02-01 19:57:39 +01:00
| ----------:| :-----: | ------------------- | ----------- |
2023-03-09 17:45:10 -06:00
| `append` | `false` | Boolean | Set this to `true` to append the `nr` to any text already set in Point `at` 's attributes, rather than overwrite it |
2021-08-25 16:09:31 +02:00
| `at` | | [Point ](/reference/api/point ) | The point at which to insert the title |
2023-03-09 17:45:10 -06:00
| `cutlist` | `true` | Boolean | Whether to include cutting instructions |
2021-08-25 16:09:31 +02:00
| `nr` | | String | The number of the pattern part |
| `title` | | String | The name of the pattern part. If title is not set or is an empty string, this won't be rendered, and the version will go beneath the nr.|
| `prefix` | | String | A prefix to add to the created points. This allow for more than 1 title per part, as long as you give them a different prefix.|
| `rotation` | 0 | Number | An optional rotation in degrees |
| `scale` | 1 | Number | An optional scaling factor |
2022-12-09 20:59:53 -08:00
## Result
| Generated Element | Description |
|-------------------|-------------|
| `points._${prefix}_titleNr` | Point anchoring the part number text |
| `points._${prefix}_titleName` | Point anchoring the part name text |
2023-03-09 17:45:10 -06:00
| `points._${prefix}_titleCut_${material}_${i} | Points anchoring the cutting instructions, by material key and instruction index |
2022-12-09 20:59:53 -08:00
| `points._${prefix}_titlePattern` | Point anchoring the pattern name text |
| `points._${prefix}_titleFor` | Point anchoring the name of the person for whom the pattern was made, if that information exists |
| `points._${prefix}_exportDate` | Point anchoring the pattern export date |