2021-10-17 18:26:00 +02:00
|
|
|
---
|
|
|
|
title: pd
|
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-30 04:39:30 +02:00
|
|
|
The `pd` macro adds a _path dimension_ to your pattern, indicating the length
|
2023-04-15 16:31:45 +02:00
|
|
|
of a path.
|
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
|
|
|
|
macro('pd', {
|
2022-09-30 04:39:30 +02:00
|
|
|
Number d,
|
|
|
|
String id,
|
|
|
|
Path path,
|
2022-12-09 20:59:53 -08:00
|
|
|
Boolean noEndMarker,
|
2022-09-30 04:39:30 +02:00
|
|
|
Boolean noStartMarker,
|
|
|
|
String text,
|
2023-10-29 17:20:35 +01:00
|
|
|
Boolean force = false,
|
2021-08-25 16:09:31 +02:00
|
|
|
})
|
|
|
|
```
|
|
|
|
|
2022-09-30 04:39:30 +02:00
|
|
|
## Example
|
|
|
|
|
|
|
|
<Example caption="An example of a path dimension with the pd macro">
|
|
|
|
```js
|
|
|
|
({ Point, Path, paths, macro, part }) => {
|
|
|
|
|
|
|
|
paths.example = new Path()
|
|
|
|
.move(new Point(0,0))
|
|
|
|
.curve(new Point(20,10), new Point(60,10), new Point(80,0))
|
|
|
|
|
|
|
|
macro('pd', {
|
|
|
|
path: paths.example,
|
|
|
|
d: 15,
|
2023-10-29 17:20:35 +01:00
|
|
|
force: true,
|
2022-09-30 04:39:30 +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
|
|
|
|----------------:|---------|---------------------|-------------|
|
|
|
|
| `path` | | [Path](/reference/api/path) | The path to draw the dimension along |
|
2022-12-09 20:59:53 -08:00
|
|
|
| `d` | 10 | Number | The offset at which to draw the dimension |
|
2021-08-25 16:09:31 +02:00
|
|
|
| `text` | Path length | Number | The text to go on the dimension if not the length of the path |
|
2023-10-29 17:20:35 +01:00
|
|
|
| `id` | `pd` | `string` | The ID of this macro instance |
|
2021-08-25 16:09:31 +02:00
|
|
|
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
|
2022-01-18 08:31:04 +01:00
|
|
|
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
|
2023-10-29 17:20:35 +01:00
|
|
|
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `paperless` is `false` |
|
2022-12-09 20:59:53 -08:00
|
|
|
|
2022-09-30 04:39:30 +02:00
|
|
|
## Notes
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2023-10-29 17:20:35 +01:00
|
|
|
This macro takes the `paperless` setting into account and won't output anything when both `paperless` and `force` are `false`.
|
2021-08-25 16:09:31 +02:00
|
|
|
|