1
0
Fork 0

fix(docs) Add missing cutlist store methods and improve cutlist docs (#7052)

* fix(docs): cutlist.removeCut() can remove all cutting instructions

* fix(docs): Add cutlist.setcut doc

* fix(docs): cutlist.addcut() signature and other improvements

* fix(docs): cutlist store methods improvements

* fix(docs) Add missing cutlist store methods

* fix(docs): Remove cutlist store methods docs from old docs location

* fix(docs): Add missing cutlist store methods

---------

Co-authored-by: Benjamin Fan <ben-git@swinglonga.com>
This commit is contained in:
BenJamesBen 2024-11-16 06:39:49 -08:00 committed by GitHub
parent 7fb499fd2b
commit 788ea77ffa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 205 additions and 17 deletions

View file

@ -5,7 +5,11 @@ title: cutlist.addCut()
The `cutlist.addCut()` store method will add a set of cutting instructions for the part. The `cutlist.addCut()` store method will add a set of cutting instructions for the part.
This information is not use by the core library, it is merely stored. This information is not use by the core library, it is merely stored.
#### Signature ## Signature
`cutlist.addCut()` accepts either an object or an array of objects
with the following signature:
```js ```js
undefined store.cutlist.addCut({ undefined store.cutlist.addCut({
Number cut, Number cut,
@ -14,9 +18,11 @@ undefined store.cutlist.addCut({
Bool onBias = false, Bool onBias = false,
Bool onFold = false, Bool onFold = false,
}) })
```` ```
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: Pass an object or an array of objects to the `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 |
| :-- | :--- | :------ | :---------- | | :-- | :--- | :------ | :---------- |
@ -40,9 +46,9 @@ You can use any `string` you want for your material, but here are some standard
::: :::
#### Example ## Example
<Example caption="An example of the title macro"> <Example caption="An example of the cutlist.addCut() store method">
```js ```js
({ Point, Path, paths, macro, store, part }) => { ({ Point, Path, paths, macro, store, part }) => {
@ -52,16 +58,16 @@ You can use any `string` you want for your material, but here are some standard
macro('title', { macro('title', {
nr: 9, nr: 9,
title: 'The title', title: 'The title',
at: new Point(0,0) at: new Point(0,0),
scale: 0.5,
}) })
// Prevent clipping // Prevent clipping
paths.diag = new Path() paths.diag = new Path()
.move(new Point(-20,-50)) .move(new Point(-10,-20))
.move(new Point(80,35)) .move(new Point(80,35))
return part return part
} }
``` ```
</Example> </Example>

View file

@ -0,0 +1,45 @@
---
title: cutlist.getCutFabrics()
---
The `cutlist.getCutFabrics()` store method will retrieve the stored
list of fabrics used by the pattern for given settings.
## Signature
```js
Array store.cutlist.getCutFabrics(settings)
```
The `custlist.getCutFabrics()` method returns an array of strings
containing the material names.
## Example
<Example caption="An example of the cutlist.getCutFabrics() store method">
```js
({ Point, points, Path, paths, store, context, part }) => {
store.cutlist.addCut({cut: 2, from: 'fabric' })
store.cutlist.addCut({cut: 2, from: 'lining' })
const materials = store.cutlist.getCutFabrics(context.settings)
let y = 0
points.header = new Point(0, y).addText('Materials used:')
for (let material of materials) {
y += 8
points[material] = new Point(5, y).addText(material)
}
// Prevent clipping
paths.diag = new Path()
.move(new Point(-10,-20))
.move(new Point(80,35))
return part
}
```
</Example>
```

View file

@ -0,0 +1,19 @@
---
title: cutlist.getGrainOrigin()
---
The `cutlist.getGrainOrigin()` store method will retrieve stored
information about which macro set the grainline.
This method is called internally by
[the `rmCutOnFold` macro](/reference/macros/rmcutonfold)
and
[the `rmGrainline` macro](/reference/macros/rmgrainline)
to retrieve information for cutting layout tools.
In other words, you typically have no reason to call this method manually.
## Signature
```js
String store.cutlist.getGrainOrigin()
```

View file

@ -2,18 +2,44 @@
title: cutlist.removeCut() title: cutlist.removeCut()
--- ---
The `store.cutlist.removeCut()` method will remove cutting instructions from the part for a given material. The `cutlist.removeCut()` store method will remove cutting instructions from the part for a given material.
If no material is provided, all cutting instructions for the part
will be removed.
## Signature
#### Signature
```js ```js
undefined cutlist.removeCut(String from) undefined store.cutlist.removeCut(String from)
``` ```
## Example ## Example
<Example caption="An example of the cutlist.removeCut() store method">
```js
({ Point, Path, paths, macro, store, part }) => {
store.cutlist.addCut({cut: 2, from: 'fabric' })
store.cutlist.addCut({cut: 2, from: 'lining' })
store.cutlist.removeCut('lining')
macro('title', {
nr: 9,
title: 'The title',
at: new Point(0,0),
scale: 0.5,
})
// Prevent clipping
paths.diag = new Path()
.move(new Point(-10,-20))
.move(new Point(80,35))
return part
}
```
</Example>
```mjs ```mjs
cutlist.removeCut('fabric') store.cutlist.removeCut('fabric')
``` ```

View file

@ -0,0 +1,15 @@
---
title: cutlist.removeCutOnFold()
---
The `cutlist.removeCutOnFold()` store method will remove stored
cut on fold line information.
This method is called internally by [the `rmCutonfold` macro](/reference/macros/rmcutonfold) to remove stored information for cutting layout tools.
In other words, you typically have no reason to call this method manually.
## Signature
```js
undefined store.cutlist.removeCutOnFold()
```

View file

@ -0,0 +1,16 @@
---
title: cutlist.removeGrain()
---
The `cutlist.removeGrain()` store method will remove stored grainline
information.
This method is called internally by [the `rmGrainline` macro](/reference/macros/rmgrainline).
to remove stored information for cutting layout tools.
In other words, you typically have no reason to call this method manually.
## Signature
```js
undefined store.cutlist.removeGrain()
```

View file

@ -0,0 +1,60 @@
---
title: cutlist.setCut()
---
The `cutlist.setCut()` store method will remove all cutting instructions
from the part
and then add a set of cutting instructions for the part.
This information is not use by the core library, it is merely stored.
## Signature
`cutlist.setCut()` accepts either an object or an array of objects
with the following signature:
```js
undefined store.cutlist.setCut({
Number cut,
String from,
Bool identical = false,
Bool onBias = false,
Bool onFold = false,
})
```
:::note RELATED
Please see [cutlist.addCut()](/reference/store-methods/cutlist.addcut)
for detailed information about the object properties used by
`cutlist.setCut()`.
:::
## Example
<Example caption="An example of the cutlist.setCut() store method">
```js
({ Point, Path, paths, macro, store, part }) => {
store.cutlist.addCut({cut: 2, from: 'fabric' })
store.cutlist.setCut({cut: 2, from: 'lining' })
macro('title', {
nr: 9,
title: 'The title',
at: new Point(0,0),
scale: 0.5,
})
// Prevent clipping
paths.diag = new Path()
.move(new Point(-10,-20))
.move(new Point(80,35))
return part
}
```
</Example>
```

View file

@ -1,13 +1,14 @@
--- ---
title: cutlist.setCutOnFold() title: cutlist.setCutOnFold()
--- ---
The `cutlist.setCutOnFold()` method will take two points to determine the cut on fold line. The `cutlist.setCutOnFold()` store method will take two points
to determine the cut on fold line.
This method is called internally by [the `cutonfold` macro](/reference/macros/cutonfold) to store information for cutting layout tools. This method is called internally by [the `cutonfold` macro](/reference/macros/cutonfold) to store information for cutting layout tools.
In other words, you typically have no reason to call this method manually. In other words, you typically have no reason to call this method manually.
#### Signature ## Signature
```js ```js
undefined cutlist.setCutOnFold(Point p1, Point p2) undefined store.cutlist.setCutOnFold(Point p1, Point p2)
``` ```

View file

@ -8,7 +8,7 @@ This method is called internally by [the `grainline` macro](/reference/macros/gr
to store information for cutting layout tools. to store information for cutting layout tools.
In other words, you typically have no reason to call this method manually. In other words, you typically have no reason to call this method manually.
#### Signature ## Signature
```js ```js
undefined store.cutlist.setGrain(Number grainAngle) undefined store.cutlist.setGrain(Number grainAngle)