1
0
Fork 0

update docs

This commit is contained in:
Enoch Riese 2023-03-12 11:35:19 -05:00
parent 1e95c9ef2c
commit 484d16f463
3 changed files with 42 additions and 44 deletions

View file

@ -2,7 +2,7 @@
title: "Include Cutting Instructions" title: "Include Cutting Instructions"
--- ---
To include cutting instructions with your part, use the [cutlist plugin](/reference/plugins/cutlist) to add the [`addCut` method](/reference/plugins/cutlist#addcut) to your part's [`draft` method](/reference/api/part/draft) To include cutting instructions with your part, use the [cutlist plugin](/reference/plugins/cutlist) to add the [`cutlist.addCut` method](/reference/plugins/cutlist#addcut) to your part's [`store`](/reference/api/store/extend)
<Tip>When you use the cutlist plugin, the [grainline plugin](/reference/plugins/grainline) and the [cut on fold plugin](/reference/plugins/cutonfold) will automatically add grain and fold information to the cutting instructions </Tip> <Tip>When you use the cutlist plugin, the [grainline plugin](/reference/plugins/grainline) and the [cut on fold plugin](/reference/plugins/cutonfold) will automatically add grain and fold information to the cutting instructions </Tip>
@ -12,7 +12,7 @@ To include cutting instructions with your part, use the [cutlist plugin](/refere
<details> <details>
<summary>addCut() Parameters</summary> <summary>addCut() Parameters</summary>
Pass an object to the `addCut` method with any of the following keys; any you don't provide will be filled with the defaults: Pass an object to the `store.cutlist.addCut` method with any of the following keys; any you don't provide will be filled with the defaults:
| Key | Type | Default | Description | | Key | Type | Default | Description |
| :-- | :--- | :------ | :---------- | | :-- | :--- | :------ | :---------- |
@ -49,9 +49,9 @@ import {pluginCutlist} from '@freesewing/plugin-cutlist'
const part = { const part = {
name: 'example.front', name: 'example.front',
plugins: [pluginCutlist], plugins: [pluginCutlist],
draft: ({part, addCut}) => { draft: ({part, store}) => {
// add instructions to cut two mirrored from main fabric // add instructions to cut two mirrored from main fabric
addCut() store.cutlist.addCut()
} }
} }
``` ```
@ -69,9 +69,9 @@ import {pluginCutlist} from '@freesewing/plugin-cutlist'
const part = { const part = {
name: 'example.front', name: 'example.front',
plugins: [pluginCutlist], plugins: [pluginCutlist],
draft: ({part, addCut}) => { draft: ({part, store}) => {
// add instructions to cut three identical from lining // add instructions to cut three identical from lining
addCut({cut: 3, material: 'lining', identical: true}) store.cutlist.addCut({cut: 3, material: 'lining', identical: true})
} }
} }
``` ```
@ -85,11 +85,11 @@ import {pluginCutlist} from '@freesewing/plugin-cutlist'
const part = { const part = {
name: 'example.front', name: 'example.front',
plugins: [pluginCutlist], plugins: [pluginCutlist],
draft: ({part, addCut}) => { draft: ({part, store}) => {
// add instructions to cut four mirrored from main fabric // add instructions to cut four mirrored from main fabric
addCut({cut: 4}) store.cutlist.addCut({cut: 4})
// add instructions to cut three identical from lining // add instructions to cut three identical from lining
addCut({cut: 3, material: 'lining', identical: true}) store.cutlist.addCut({cut: 3, material: 'lining', identical: true})
} }
} }
``` ```
@ -106,7 +106,7 @@ import {pluginCutonfold} from '@freesewing/plugin-cutonfold'
const part = { const part = {
name: 'example.front', name: 'example.front',
plugins: [pluginCutlist, pluginCutonfold], plugins: [pluginCutlist, pluginCutonfold],
draft: ({part, points, Point, macro, addCut}) => { draft: ({part, points, Point, macro, store}) => {
// set the cut on fold line // set the cut on fold line
points.p1 = new Point(0, 0) points.p1 = new Point(0, 0)
points.p2 = new Point(0, 10) points.p2 = new Point(0, 10)
@ -115,9 +115,9 @@ const part = {
macro('cutonfold', {from: points.p1, to: points.p2}) macro('cutonfold', {from: points.p1, to: points.p2})
// cut two on the fold // cut two on the fold
addCut() store.cutlist.addCut()
// cut two, not on the fold // cut two, not on the fold
addCut({cut: 2, ignoreOnFold: true}) store.cutlist.addCut({cut: 2, ignoreOnFold: true})
} }
} }
``` ```
@ -133,7 +133,7 @@ import {pluginGrainline} from '@freesewing/plugin-grainline'
const part = { const part = {
name: 'example.front', name: 'example.front',
plugins: [pluginCutlist, pluginGrainline], plugins: [pluginCutlist, pluginGrainline],
draft: ({part, points, Point, macro, addCut}) => { draft: ({part, points, Point, macro, store}) => {
// set the cut on fold line // set the cut on fold line
points.p1 = new Point(0, 0) points.p1 = new Point(0, 0)
points.p2 = new Point(0, 10) points.p2 = new Point(0, 10)
@ -142,9 +142,9 @@ const part = {
macro('grainline', {from: points.p1, to: points.p2}) macro('grainline', {from: points.p1, to: points.p2})
// cut two mirrored on the grain // cut two mirrored on the grain
addCut() store.cutlist.addCut()
// cut two mirrored on the bias // cut two mirrored on the bias
addCut({cut: 2, bias: true}) store.cutlist.addCut({cut: 2, bias: true})
} }
} }
``` ```

View file

@ -45,5 +45,3 @@ access the following properties:
| `Bezier` | The [bezier-js](https://pomax.github.io/bezierjs/) library's `Bezier` named export | | `Bezier` | The [bezier-js](https://pomax.github.io/bezierjs/) library's `Bezier` named export |
|| **_Return value_** | || **_Return value_** |
| `part` | Your draft method **must** return this | | `part` | Your draft method **must** return this |
<Note> Some plugins, such as the [cutlist plugin](/reference/plugins/cutlist) add additional methods to this object that can be accessed through the same destructuring </Note>

View file

@ -2,7 +2,7 @@
title: plugin-cutlist title: plugin-cutlist
--- ---
Published as [@freesewing/plugin-cutlist][1], this plugin provides additional methods to the [part draft function](/reference/api/part/draft) which allow you to configure cutting instructions for your parts. Published as [@freesewing/plugin-cutlist][1], this plugin adds additional methods to the [store](/reference/api/store/extend) which allow you to configure cutting instructions for your parts.
<Tip> For an in-depth look at how to add cutting instructions to your part, see our [cutlist how-to](/howtos/design/cutlist) </Tip> <Tip> For an in-depth look at how to add cutting instructions to your part, see our [cutlist how-to](/howtos/design/cutlist) </Tip>
@ -29,16 +29,16 @@ import { pluginCutlist } from '@freesewing/plugin-cutlist'
The cutlist plugin adds the following methods to the part draft method parameter The cutlist plugin adds the following methods to the part draft method parameter
### addCut ### store.cutlist.addCut
The `addCut()` method will add a set of cutting instructions for the part The `store.cutlist.addCut()` method will add a set of cutting instructions for the part
#### Signature #### Signature
```js ```js
addCut(Object so) store.cutlist.addCut(Object so)
```` ````
Pass an object to the `addCut` method with any of the following keys; any you don't provide will be filled with the defaults: Pass an object to the `store.cutlist.addCut` method with any of the following keys; any you don't provide will be filled with the defaults:
| Key | Type | Default | Description | | Key | Type | Default | Description |
| :-- | :--- | :------ | :---------- | | :-- | :--- | :------ | :---------- |
@ -76,11 +76,11 @@ import {pluginCutlist} from '@freesewing/plugin-cutlist'
const part = { const part = {
name: 'example.front', name: 'example.front',
plugins: [pluginCutlist], plugins: [pluginCutlist],
draft: ({part, addCut}) => { draft: ({part, store}) => {
// add instructions to cut two from main fabric // add instructions to cut two from main fabric
addCut() store.cutlist.addCut()
// add instructions to cut four on the biad from lining // add instructions to cut four on the biad from lining
addCut({cut: 4, material: 'lining', bias: true, }) store.cutlist.addCut({cut: 4, material: 'lining', bias: true, })
return part return part
} }
} }
@ -93,24 +93,24 @@ import {pluginCutlist} from '@freesewing/plugin-cutlist'
const part = { const part = {
name: 'example.front', name: 'example.front',
plugins: [pluginCutlist], plugins: [pluginCutlist],
draft: ({part, addCut}) => { draft: ({part, store}) => {
// add instructions to 1 from lining // add instructions to 1 from lining
addCut({cut: 1, material: 'lining'}) store.cutlist.addCut({cut: 1, material: 'lining'})
// add instructions to cut 1 on the bias from lining // add instructions to cut 1 on the bias from lining
addCut({cut: 1, material: 'lining', bias: true, }) store.cutlist.addCut({cut: 1, material: 'lining', bias: true, })
return part return part
} }
} }
``` ```
### removeCut ### store.cutlist.removeCut
The `removeCut()` method will remove cutting instructions from the part The `store.cutlist.removeCut()` method will remove cutting instructions from the part
#### Signature #### Signature
```js ```js
removeCut(String material) store.cutlist.removeCut(String material)
``` ```
#### Example #### Example
@ -120,24 +120,24 @@ import {pluginCutlist} from '@freesewing/plugin-cutlist'
const part = { const part = {
name: 'example.front', name: 'example.front',
plugins: [pluginCutlist], plugins: [pluginCutlist],
draft: ({part, removeCut}) => { draft: ({part, store}) => {
// remove all cutting instructions for all materials // remove all cutting instructions for all materials
removeCut() store.cutlist.removeCut()
// remove cutting instructions for just one material // remove cutting instructions for just one material
removeCut('fabric') store.cutlist.removeCut('fabric')
return part return part
} }
} }
``` ```
### setGrain ### store.cutlist.setGrain
The `setGrain()` method will record the angle of the grainline annotation. This method is called internally by [`plugin-grainline`](/reference/plugins/grainline) to store information for cutting layout tools. You shouldn't have to call it, but it's there if you need it. The `store.cutlist.setGrain()` method will record the angle of the grainline annotation. This method is called internally by [`plugin-grainline`](/reference/plugins/grainline) to store information for cutting layout tools. You shouldn't have to call it, but it's there if you need it.
#### Signature #### Signature
```js ```js
setGrain(Number grainAngle) store.cutlist.setGrain(Number grainAngle)
``` ```
#### Example #### Example
@ -147,21 +147,21 @@ import {pluginCutlist} from '@freesewing/plugin-cutlist'
const part = { const part = {
name: 'example.front', name: 'example.front',
plugins: [pluginCutlist], plugins: [pluginCutlist],
draft: ({part, setGrain}) => { draft: ({part, store}) => {
// set the grainline angle // set the grainline angle
setGrain(0) store.cutlist.setGrain(0)
return part return part
} }
} }
``` ```
### setCutOnFold ### store.cutlist.setCutOnFold
The `setCutOnFold()` method will record the points that make up the cut on fold line. This method is called internally by [`plugin-cutonfold`](/reference/plugins/cutonfold) to store information for cutting layout tools. You shouldn't have to call it, but it's there if you need it. The `store.cutlist.setCutOnFold()` method will record the points that make up the cut on fold line. This method is called internally by [`plugin-cutonfold`](/reference/plugins/cutonfold) to store information for cutting layout tools. You shouldn't have to call it, but it's there if you need it.
#### Signature #### Signature
```js ```js
setCutOnFold(Point p1, Point p2) store.cutlist.setCutOnFold(Point p1, Point p2)
``` ```
#### Example #### Example
@ -171,11 +171,11 @@ import {pluginCutlist} from '@freesewing/plugin-cutlist'
const part = { const part = {
name: 'example.front', name: 'example.front',
plugins: [pluginCutlist], plugins: [pluginCutlist],
draft: ({part, points, Point, setCutOnFold}) => { draft: ({part, points, Point, store}) => {
// set the cut on fold line // set the cut on fold line
points.p1 = new Point(0, 0) points.p1 = new Point(0, 0)
points.p2 = new Point(0, 10) points.p2 = new Point(0, 10)
setCutOnFold(points.p1, points.p2) store.cutlist.setCutOnFold(points.p1, points.p2)
return part return part
} }
} }