Merge branch 'develop' into joost
This commit is contained in:
commit
ed1ac8a7a7
992 changed files with 13580 additions and 8382 deletions
|
@ -60,6 +60,7 @@ The following named exports are **utility methods**:
|
|||
| Named export | Description |
|
||||
| ------------ | ------------|
|
||||
| `beamIntersectsCircle` | See the [beamIntersectsCircle](/reference/api/utils/beamintersectscircle) documentation |
|
||||
| `beamIntersectsCurve` | See the [beamIntersectsCurve](/reference/api/utils/beamintersectscurve) documentation |
|
||||
| `beamIntersectsX` | See the [beamIntersectsX](/reference/api/utils/beamintersectsx) documentation |
|
||||
| `beamIntersectsY` | See the [beamIntersectsY](/reference/api/utils//beamintersectsy) documentation |
|
||||
| `beamsIntersect` | See the [beamsIntersect](/reference/api/utils/beamsintersect) documentation |
|
||||
|
|
57
markdown/dev/reference/api/part/attr/en.md
Normal file
57
markdown/dev/reference/api/part/attr/en.md
Normal file
|
@ -0,0 +1,57 @@
|
|||
---
|
||||
title: Part.attr()
|
||||
---
|
||||
|
||||
This `Part.attr()` method can be used to add attributes to the Part object.
|
||||
It calls `this.attributes.add()` under the hood, and returns the Part object.
|
||||
|
||||
If the third parameter is set to `true` it will call `this.attributes.set()`
|
||||
instead, thereby overwriting the value of the attribute.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
|
||||
Part Part.attr(
|
||||
string name,
|
||||
mixed value,
|
||||
bool overwrite = false
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
<Tip compact>
|
||||
|
||||
This method is chainable as it returns the `Part` object
|
||||
|
||||
</Tip>
|
||||
|
||||
## Example
|
||||
|
||||
<Example caption=" Example of the Part.attr() method">
|
||||
|
||||
```js
|
||||
|
||||
({ part, points, Point, Path, paths }) => {
|
||||
|
||||
points.A = new Point(0,0)
|
||||
points.B = new Point(0,40)
|
||||
points.C = new Point(100,40)
|
||||
|
||||
paths.line = new Path()
|
||||
.move(points.B)
|
||||
.line(points.C)
|
||||
.line(points.A)
|
||||
.line(points.B)
|
||||
.close()
|
||||
.addText('I have been flipped!', 'left')
|
||||
|
||||
part.attr('transform', 'scale(1,-1) translate(0,-40)')
|
||||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
</Example>
|
||||
|
27
markdown/dev/reference/api/part/props/en.md
Normal file
27
markdown/dev/reference/api/part/props/en.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: Part.asProps()
|
||||
---
|
||||
|
||||
This `Part.asProps()` method can be used to return the part as an object that is suitable for inclusion in renderprops. This method is used internally and is only required when building your own render system.
|
||||
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
|
||||
Part.prototype.asProps = function ()
|
||||
return {
|
||||
paths: this.paths,
|
||||
points: this.points,
|
||||
snippets: this.snippets,
|
||||
attributes: this.attributes,
|
||||
height: this.height,
|
||||
width: this.width,
|
||||
bottomRight: this.bottomRight,
|
||||
topLeft: this.topLeft,
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
49
markdown/dev/reference/api/point/slope/en.md
Normal file
49
markdown/dev/reference/api/point/slope/en.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
title: Point.slope()
|
||||
---
|
||||
|
||||
The `Point.slope()` method returns the slope (dy/dx) of a line between two Points.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
|
||||
point.slope(otherPoint)
|
||||
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
<Example caption="An example of the Point.slope() method">
|
||||
|
||||
```js
|
||||
|
||||
({ Point, points, Path, paths, Snippet, snippets, part, macro }) => {
|
||||
|
||||
points.A = new Point(0,0)
|
||||
points.B = new Point(200,150)
|
||||
|
||||
const slope = points.A.slope(points.B)
|
||||
|
||||
macro('hd', {
|
||||
from: points.A,
|
||||
to: points.B,
|
||||
y: points.B.y,
|
||||
})
|
||||
macro('vd', {
|
||||
to: points.B,
|
||||
from: points.A,
|
||||
x: 0,
|
||||
})
|
||||
|
||||
paths.line = new Path()
|
||||
.move(points.A)
|
||||
.line(points.B)
|
||||
.attr("class", "canvas")
|
||||
.setText("Slope: " + slope, "center text-lg")
|
||||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
62
markdown/dev/reference/api/utils/beamintersectscurve/en.md
Normal file
62
markdown/dev/reference/api/utils/beamintersectscurve/en.md
Normal file
|
@ -0,0 +1,62 @@
|
|||
---
|
||||
title: utils.beamIntersectsCurve()
|
||||
---
|
||||
|
||||
The `utils.beamIntersectsCurve()` function finds the intersection between an endless
|
||||
line and a curve described by points
|
||||
`start`, `cp1`, `cp2, and `end\`.
|
||||
|
||||
<Warning>
|
||||
|
||||
This function can sometimes fail to find intersections in some curves
|
||||
due to a limitation in an underlying Bézier library.
|
||||
Please see [Bug #3367](https://github.com/freesewing/freesewing/issues/3367)
|
||||
for more information.
|
||||
|
||||
</Warning>
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
array | false utils.beamIntersectsCurve(
|
||||
Point from,
|
||||
Point to,
|
||||
Point start,
|
||||
Point cp1,
|
||||
Point cp2,
|
||||
Point end
|
||||
)
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
<Example caption="A Utils.beamIntersectsCurve() example">
|
||||
```js
|
||||
({ Point, points, Path, paths, Snippet, snippets, getId, utils, part }) => {
|
||||
|
||||
points.A = new Point(10, 10)
|
||||
points.Acp = new Point(10, 40)
|
||||
points.B = new Point(110, 10)
|
||||
points.Bcp = new Point(110, 40)
|
||||
points.E = new Point(45, 25)
|
||||
points.D = new Point(65, 25)
|
||||
paths.curve = new Path()
|
||||
.move(points.A)
|
||||
.curve(points.Acp, points.Bcp, points.B)
|
||||
paths.line = new Path().move(points.E).line(points.D)
|
||||
|
||||
for (let p of utils.beamIntersectsCurve(
|
||||
points.D,
|
||||
points.E,
|
||||
points.A,
|
||||
points.Acp,
|
||||
points.Bcp,
|
||||
points.B
|
||||
)) {
|
||||
snippets[getId()] = new Snippet("notch", p)
|
||||
}
|
||||
|
||||
return part
|
||||
}
|
||||
```
|
||||
</Example>
|
|
@ -24,6 +24,7 @@ The annotations plugin provides the following macros:
|
|||
- [bartackFractionAlong](/reference/macros/bartackfractionalong)
|
||||
- [crossbox](/reference/macros/crossbox)
|
||||
- [cutonfold](/reference/macros/cutonfold)
|
||||
- [grainline](/reference/macros/grainline)
|
||||
- [hd](/reference/macros/hd)
|
||||
- [ld](/reference/macros/ld)
|
||||
- [rmad](/reference/macros/rmad)
|
||||
|
@ -35,6 +36,11 @@ The annotations plugin provides the following macros:
|
|||
- [title](/reference/macros/title)
|
||||
- [vd](/reference/macros/vd)
|
||||
|
||||
The annotations plugin also provides [methods to the Store for adding cutting instructions](#methods)
|
||||
|
||||
<Tip> For an in-depth look at how to add cutting instructions to your part, see our [cutlist how-to](/howtos/design/cutlist) </Tip>
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
|
@ -54,6 +60,160 @@ import { annotationsPlugin } from '@freesewing/plugin-banner'
|
|||
import { pluginAnnotations } from '@freesewing/plugin-banner'
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
### store.cutlist.addCut
|
||||
|
||||
The `store.cutlist.addCut()` method will add a set of cutting instructions for the part
|
||||
|
||||
#### Signature
|
||||
```js
|
||||
store.cutlist.addCut(Object so)
|
||||
````
|
||||
|
||||
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 |
|
||||
| :-- | :--- | :------ | :---------- |
|
||||
| cut | Number\|false | 2 | the number of pieces to cut from the specified material. Pass `false` to clear all cutting instructions for the material |
|
||||
| material | String | 'fabric' | the translation key of the material to cut from |
|
||||
| identical | Boolean | false | should even numbers of pieces be cut in the same direction? false for mirrored |
|
||||
| bias | Boolean | false | should the pieces in these cutting instructions be cut on the bias |
|
||||
| ignoreOnFold | Boolean | false | should these cutting instructions ignore any cutOnFold information set by the part |
|
||||
|
||||
<Note>
|
||||
<details>
|
||||
<summary> You can use any `string` you want for your material, but here are some standard ones we have translation for </summary>
|
||||
<div>
|
||||
|
||||
| Key | Translation |
|
||||
|:--|:--|
|
||||
| fabric | Main Fabric |
|
||||
| lining | Lining |
|
||||
| canvas | Canvas |
|
||||
| lmhCanavas | Light to Medium Hair Canvas |
|
||||
| heavyCanvas | Heavyweight Hair Canvas |
|
||||
| interfacing | Interfacing |
|
||||
| plastic | Plastic |
|
||||
| ribbing | Ribbing |
|
||||
|
||||
</div>
|
||||
</details>
|
||||
</Note>
|
||||
|
||||
#### Example
|
||||
|
||||
```js
|
||||
import {pluginCutlist} from '@freesewing/plugin-cutlist'
|
||||
|
||||
const part = {
|
||||
name: 'example.front',
|
||||
plugins: [pluginCutlist],
|
||||
draft: ({part, store}) => {
|
||||
// add instructions to cut two from main fabric
|
||||
store.cutlist.addCut()
|
||||
// add instructions to cut four on the bias from lining
|
||||
store.cutlist.addCut({cut: 4, material: 'lining', bias: true, })
|
||||
return part
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can also add multiple sets of cutting instructions for the same material
|
||||
```js
|
||||
import {pluginCutlist} from '@freesewing/plugin-cutlist'
|
||||
|
||||
const part = {
|
||||
name: 'example.front',
|
||||
plugins: [pluginCutlist],
|
||||
draft: ({part, store}) => {
|
||||
// add instructions to 1 from lining
|
||||
store.cutlist.addCut({cut: 1, material: 'lining'})
|
||||
// add instructions to cut 1 on the bias from lining
|
||||
store.cutlist.addCut({cut: 1, material: 'lining', bias: true, })
|
||||
return part
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### store.cutlist.removeCut
|
||||
|
||||
The `store.cutlist.removeCut()` method will remove cutting instructions from the part
|
||||
|
||||
#### Signature
|
||||
|
||||
```js
|
||||
store.cutlist.removeCut(String material)
|
||||
```
|
||||
|
||||
#### Example
|
||||
```js
|
||||
import {pluginCutlist} from '@freesewing/plugin-cutlist'
|
||||
|
||||
const part = {
|
||||
name: 'example.front',
|
||||
plugins: [pluginCutlist],
|
||||
draft: ({part, store}) => {
|
||||
// remove all cutting instructions for all materials
|
||||
store.cutlist.removeCut()
|
||||
|
||||
// remove cutting instructions for just one material
|
||||
store.cutlist.removeCut('fabric')
|
||||
return part
|
||||
}
|
||||
}
|
||||
```
|
||||
### store.cutlist.setGrain
|
||||
|
||||
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
|
||||
|
||||
```js
|
||||
store.cutlist.setGrain(Number grainAngle)
|
||||
```
|
||||
|
||||
#### Example
|
||||
```js
|
||||
import {pluginCutlist} from '@freesewing/plugin-cutlist'
|
||||
|
||||
const part = {
|
||||
name: 'example.front',
|
||||
plugins: [pluginCutlist],
|
||||
draft: ({part, store}) => {
|
||||
// set the grainline angle
|
||||
store.cutlist.setGrain(0)
|
||||
return part
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### store.cutlist.setCutOnFold
|
||||
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
|
||||
|
||||
```js
|
||||
store.cutlist.setCutOnFold(Point p1, Point p2)
|
||||
```
|
||||
|
||||
#### Example
|
||||
```js
|
||||
import {pluginCutlist} from '@freesewing/plugin-cutlist'
|
||||
|
||||
const part = {
|
||||
name: 'example.front',
|
||||
plugins: [pluginCutlist],
|
||||
draft: ({part, points, Point, store}) => {
|
||||
// set the cut on fold line
|
||||
points.p1 = new Point(0, 0)
|
||||
points.p2 = new Point(0, 10)
|
||||
store.cutlist.setCutOnFold(points.p1, points.p2)
|
||||
return part
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
The annotations plugin is part of our [plugin-bundle](/reference/plugins/bundle)
|
||||
|
|
|
@ -8,20 +8,12 @@ commonly used FreeSewing time plugins in one handy package.
|
|||
Specifically, loading this plugin will have the same effect as loading these
|
||||
plugins individually:
|
||||
|
||||
- [plugin-banner](/reference/plugins/banner) : Add repeating text to your patterns
|
||||
- [plugin-bartack](/reference/plugins/bartack) : Add bartacks to your patterns
|
||||
- [plugin-buttons](/reference/plugins/buttons) : Add buttons, buttonholes, and snaps to your patterns
|
||||
- [plugin-cutonfold](/reference/plugins/cutonfold) : Add cut-on-fold indicators to your patterns
|
||||
- [plugin-dimension](/reference/plugins/dimension) : Add dimensions to your (paperless) patterns
|
||||
- [plugin-grainline](/reference/plugins/grainline) : Add grainline indicators to your patterns
|
||||
- [plugin-logo](/reference/plugins/logo) : Add a FreeSewing logo to your patterns
|
||||
|
||||
- [plugin-annotations](/reference/plugins/annotations)
|
||||
- [plugin-measurements](/reference/plugins/measurements) : Make extra, calculated measurements available to your patterns
|
||||
- [plugin-mirror](/reference/plugins/mirror) : Mirror points and paths in your patterns
|
||||
- [plugin-notches](/reference/plugins/notches) : Add notches to your patterns
|
||||
- [plugin-scalebox](/reference/plugins/scalebox) : Add scaleboxes to your pattern parts
|
||||
- [plugin-round](/reference/plugins/round) : Create rounded corners in your patterns
|
||||
- [plugin-sprinkle](/reference/plugins/sprinkle) : Add multiple snippets to your patterns
|
||||
- [plugin-title](/reference/plugins/title) : Add pretty titles to your pattern parts
|
||||
|
||||
## Installation
|
||||
|
||||
|
|
|
@ -1,188 +0,0 @@
|
|||
---
|
||||
title: plugin-cutlist
|
||||
---
|
||||
|
||||
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>
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install @freesewing/plugin-cutonfold
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Either [add it as a part plugin](/reference/api/part/config/plugins) in your
|
||||
design, or [add it to a pattern instance with
|
||||
Pattern.use()](/reference/api/pattern/use).
|
||||
|
||||
To import the plugin for use:
|
||||
```js
|
||||
import { cutlistPlugin } from '@freesewing/plugin-cutlist'
|
||||
// or
|
||||
import { pluginCutlist } from '@freesewing/plugin-cutlist'
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
The cutlist plugin adds the following methods to the part draft method parameter
|
||||
|
||||
### store.cutlist.addCut
|
||||
|
||||
The `store.cutlist.addCut()` method will add a set of cutting instructions for the part
|
||||
|
||||
#### Signature
|
||||
```js
|
||||
store.cutlist.addCut(Object so)
|
||||
````
|
||||
|
||||
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 |
|
||||
| :-- | :--- | :------ | :---------- |
|
||||
| cut | Number\|false | 2 | the number of pieces to cut from the specified material. Pass `false` to clear all cutting instructions for the material |
|
||||
| material | String | 'fabric' | the translation key of the material to cut from |
|
||||
| identical | Boolean | false | should even numbers of pieces be cut in the same direction? false for mirrored |
|
||||
| bias | Boolean | false | should the pieces in these cutting instructions be cut on the bias |
|
||||
| ignoreOnFold | Boolean | false | should these cutting instructions ignore any cutOnFold information set by the part |
|
||||
|
||||
<Note>
|
||||
<details>
|
||||
<summary> You can use any `string` you want for your material, but here are some standard ones we have translation for </summary>
|
||||
<div>
|
||||
|
||||
| Key | Translation |
|
||||
|:--|:--|
|
||||
| fabric | Main Fabric |
|
||||
| lining | Lining |
|
||||
| canvas | Canvas |
|
||||
| lmhCanavas | Light to Medium Hair Canvas |
|
||||
| heavyCanvas | Heavyweight Hair Canvas |
|
||||
| interfacing | Interfacing |
|
||||
| plastic | Plastic |
|
||||
| ribbing | Ribbing |
|
||||
|
||||
</div>
|
||||
</details>
|
||||
</Note>
|
||||
|
||||
#### Example
|
||||
|
||||
```js
|
||||
import {pluginCutlist} from '@freesewing/plugin-cutlist'
|
||||
|
||||
const part = {
|
||||
name: 'example.front',
|
||||
plugins: [pluginCutlist],
|
||||
draft: ({part, store}) => {
|
||||
// add instructions to cut two from main fabric
|
||||
store.cutlist.addCut()
|
||||
// add instructions to cut four on the biad from lining
|
||||
store.cutlist.addCut({cut: 4, material: 'lining', bias: true, })
|
||||
return part
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can also add multiple sets of cutting instructions for the same material
|
||||
```js
|
||||
import {pluginCutlist} from '@freesewing/plugin-cutlist'
|
||||
|
||||
const part = {
|
||||
name: 'example.front',
|
||||
plugins: [pluginCutlist],
|
||||
draft: ({part, store}) => {
|
||||
// add instructions to 1 from lining
|
||||
store.cutlist.addCut({cut: 1, material: 'lining'})
|
||||
// add instructions to cut 1 on the bias from lining
|
||||
store.cutlist.addCut({cut: 1, material: 'lining', bias: true, })
|
||||
return part
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### store.cutlist.removeCut
|
||||
|
||||
The `store.cutlist.removeCut()` method will remove cutting instructions from the part
|
||||
|
||||
#### Signature
|
||||
|
||||
```js
|
||||
store.cutlist.removeCut(String material)
|
||||
```
|
||||
|
||||
#### Example
|
||||
```js
|
||||
import {pluginCutlist} from '@freesewing/plugin-cutlist'
|
||||
|
||||
const part = {
|
||||
name: 'example.front',
|
||||
plugins: [pluginCutlist],
|
||||
draft: ({part, store}) => {
|
||||
// remove all cutting instructions for all materials
|
||||
store.cutlist.removeCut()
|
||||
|
||||
// remove cutting instructions for just one material
|
||||
store.cutlist.removeCut('fabric')
|
||||
return part
|
||||
}
|
||||
}
|
||||
```
|
||||
### store.cutlist.setGrain
|
||||
|
||||
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
|
||||
|
||||
```js
|
||||
store.cutlist.setGrain(Number grainAngle)
|
||||
```
|
||||
|
||||
#### Example
|
||||
```js
|
||||
import {pluginCutlist} from '@freesewing/plugin-cutlist'
|
||||
|
||||
const part = {
|
||||
name: 'example.front',
|
||||
plugins: [pluginCutlist],
|
||||
draft: ({part, store}) => {
|
||||
// set the grainline angle
|
||||
store.cutlist.setGrain(0)
|
||||
return part
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### store.cutlist.setCutOnFold
|
||||
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
|
||||
|
||||
```js
|
||||
store.cutlist.setCutOnFold(Point p1, Point p2)
|
||||
```
|
||||
|
||||
#### Example
|
||||
```js
|
||||
import {pluginCutlist} from '@freesewing/plugin-cutlist'
|
||||
|
||||
const part = {
|
||||
name: 'example.front',
|
||||
plugins: [pluginCutlist],
|
||||
draft: ({part, points, Point, store}) => {
|
||||
// set the cut on fold line
|
||||
points.p1 = new Point(0, 0)
|
||||
points.p2 = new Point(0, 10)
|
||||
store.cutlist.setCutOnFold(points.p1, points.p2)
|
||||
return part
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
The cutlist plugin is part of our [plugin-bundle](/reference/plugins/bundle)
|
||||
|
||||
[1]: https://www.npmjs.com/package/@freesewing/plugin-cutlist
|
Loading…
Add table
Add a link
Reference in a new issue