The part's draft method
Each part must have a draft
property that holds a method that will draft the part.
In other words, this method is where the actual work happens. The method's signature
is as follows:
function draft(props)
The draft method receives a single parameter, an object which you can destructure to access the following properties:
Property | Description |
---|---|
Content constructors | |
Path | A Path constructor to create new paths |
Point | A Point constructor to create new points |
Snippet | A Snippet constructor to create new snippets |
Content containers | |
paths | Add a Path to your part by adding it to this object |
points | Add a Points to your part by adding it to this object |
snippets | Add a Snippet to your part by adding it to this object |
Access to settings | |
absoluteOptions | Access to settings.absoluteOptions |
complete | Access to settings.complete |
measurements | Access to settings.measurements |
options | Access to settings.options |
paperless | Access to settings.paperless |
sa | Access to settings.sa |
scale | Access to settings.scale |
Access to utilities | |
context | Allows access to the pattern object and other things higher in the tree |
getId | See the getId documentation |
log | See the Store Methods documentation |
macro | See the macros documentation |
store | See the store documentation |
units | A version of utils.units() that is preconfigured with the user's chosen units |
utils | See the utils documentation |
Bezier | The bezier-js library's Bezier named export |
Return value | |
part | Your draft method must return this |
tip
Please note that there is no optionalMeasurements
property.
Instead, optional measurements are accessed via the 'measurements'
property.