2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
title: Adding paths
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-10-12 14:42:45 +02:00
|
|
|
Paths should be stored in the `paths` key of the object passed to your part's
|
2022-12-22 17:24:59 -08:00
|
|
|
draft method. The constructor for paths is available in the `Path` key. You can
|
2022-10-12 14:42:45 +02:00
|
|
|
destructure them for easy access.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-10-12 14:42:45 +02:00
|
|
|
<Example caption="An example of adding a path" tutorial>
|
|
|
|
```design/src/part.mjs
|
|
|
|
function draftPart = ({
|
|
|
|
Point,
|
|
|
|
// highlight-start
|
|
|
|
Path,
|
|
|
|
paths,
|
|
|
|
// highlight-end
|
|
|
|
part
|
|
|
|
}) {
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-10-12 14:42:45 +02:00
|
|
|
// highlight-start
|
|
|
|
paths.demo = new Path()
|
|
|
|
.move(new Point(0,0))
|
|
|
|
.line(new Point(100,20))
|
|
|
|
.addClass('lining lashed')
|
|
|
|
// highlight-end
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-10-12 14:42:45 +02:00
|
|
|
return part
|
|
|
|
}
|
|
|
|
```
|
|
|
|
</Example>
|