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:

Javascript
function draft(props
)

The draft method receives a single parameter, an object which you can destructure to access the following properties:

PropertyDescription
Content constructors
PathA Path constructor to create new paths
PointA Point constructor to create new points
SnippetA Snippet constructor to create new snippets
Content containers
pathsAdd a Path to your part by adding it to this object
pointsAdd a Points to your part by adding it to this object
snippetsAdd a Snippet to your part by adding it to this object
Access to settings
absoluteOptionsAccess to settings.absoluteOptions
completeAccess to settings.complete
measurementsAccess to settings.measurements
optionsAccess to settings.options
paperlessAccess to settings.paperless
saAccess to settings.sa
scaleAccess to settings.scale
Access to utilities
contextAllows access to the pattern object and other things higher in the tree
getIdSee the getId documentation
logSee the Store Methods documentation
macroSee the macros documentation
storeSee the store documentation
unitsA version of utils.units() that is preconfigured with the user’s chosen units
utilsSee the utils documentation
BezierThe bezier-js library’s Bezier named export
Return value
partYour draft method must return this
TIP

Please note that there is no optionalMeasurements property. Instead, optional measurements are accessed via the ‘measurements’ property.