2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
title: Adding points
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-10-12 14:42:45 +02:00
|
|
|
Points should be stored in the `points` key of the object passed to your part's
|
2022-12-22 17:24:59 -08:00
|
|
|
draft method. The constructor for points is available in the `Point` key. You
|
2022-10-12 14:42:45 +02:00
|
|
|
can 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 point" tutorial>
|
|
|
|
```design/src/part.mjs
|
|
|
|
function draftPart = ({
|
|
|
|
// highlight-start
|
|
|
|
Point,
|
|
|
|
points,
|
|
|
|
// highlight-end
|
|
|
|
part
|
|
|
|
}) {
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-10-12 14:42:45 +02:00
|
|
|
// highlight-start
|
|
|
|
points.demo = new Point(0,0).addText('hi')
|
|
|
|
// highlight-end
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-10-12 14:42:45 +02:00
|
|
|
return part
|
|
|
|
}
|
|
|
|
```
|
|
|
|
</Example>
|