2021-10-17 18:26:00 +02:00
|
|
|
---
|
2022-10-01 23:05:57 +02:00
|
|
|
title: Core API
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-09-25 17:05:18 +02:00
|
|
|
This is the documentation for FreeSewing's core library, published as `@freesewing/core` on NPM.
|
2022-02-19 08:04:25 +01:00
|
|
|
It's a complete toolbox for parametric design with a primary focus on
|
2021-09-25 17:05:18 +02:00
|
|
|
sewing patterns, but can be utilized for a variety of similar 2D design tasks.
|
|
|
|
|
2022-09-20 18:09:28 +02:00
|
|
|
<Tip>
|
2021-09-25 17:05:18 +02:00
|
|
|
|
2022-09-20 18:09:28 +02:00
|
|
|
##### Looking to get started?
|
2021-09-25 17:05:18 +02:00
|
|
|
|
2022-09-20 18:09:28 +02:00
|
|
|
You are currently browsing the reference documentation.
|
|
|
|
Please refer to [the quick start guide](/guides/quick) to get started.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-20 18:09:28 +02:00
|
|
|
</Tip>
|
2021-09-25 17:05:18 +02:00
|
|
|
|
2022-09-20 18:09:28 +02:00
|
|
|
## Named exports
|
2021-09-25 17:05:18 +02:00
|
|
|
|
2022-09-20 18:09:28 +02:00
|
|
|
<Note>
|
|
|
|
|
|
|
|
Ever since version 3 of FreeSewing, we use only named exports, and no default exports.
|
|
|
|
|
|
|
|
Refer to [the migration guide](/guides/v3) for more details.
|
2021-09-25 17:05:18 +02:00
|
|
|
|
2022-09-20 18:09:28 +02:00
|
|
|
</Note>
|
|
|
|
|
|
|
|
The `@freesewing/core` package provides the following named exports:
|
2021-09-25 17:05:18 +02:00
|
|
|
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-20 18:09:28 +02:00
|
|
|
| Named export | Description |
|
|
|
|
| ------------ | ------------|
|
|
|
|
| version | The version of `@freesewing/core` |
|
|
|
|
| Bezier | A re-export of [the bezier-js dependency](https://www.npmjs.com/package/bezier-js) |
|
|
|
|
|
|
|
|
The following named exports are **constructors**:
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-09-25 17:05:18 +02:00
|
|
|
<Note>
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-08-27 21:49:14 +02:00
|
|
|
You will typically use the `Design()` constructor.
|
2022-09-20 18:09:28 +02:00
|
|
|
The other constructors and utilities below are exported to
|
|
|
|
facilitate unit testing and other specific use cases.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-09-25 17:05:18 +02:00
|
|
|
</Note>
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-20 18:09:28 +02:00
|
|
|
| Named export | Description |
|
|
|
|
| ------------ | ------------|
|
|
|
|
| `Design` | The [Design](/reference/api/design) constructor |
|
|
|
|
| `Attributes` | The [Attributes](/reference/api/attributes) constructor |
|
|
|
|
| `Pattern` | The [Pattern](/reference/api/pattern) constructor |
|
|
|
|
| `Point` | The [Point](/reference/api/point) constructor |
|
|
|
|
| `Path` | The [Path](/reference/api/path) constructor |
|
|
|
|
| `Part` | The [Part](/reference/api/part) constructor |
|
|
|
|
| `Snippet` | The [Snippet](/reference/api/snippet) constructor |
|
|
|
|
| `Store` | The [Store](/reference/api/store) constructor |
|
|
|
|
|
|
|
|
|
|
|
|
The following named exports are **uitility methods**:
|
|
|
|
|
|
|
|
| Named export | Description |
|
|
|
|
| ------------ | ------------|
|
|
|
|
| `beamIntersectsCircle` | See the [beamIntersectsCircle](/reference/api/utils/beamintersectsCircle) documentation |
|
|
|
|
| `beamIntersectsX` | See the [beamIntersectsX](/reference/api/utils/beamintersectsX) documentation |
|
|
|
|
| `beamIntersectsY` | See the [beamIntersectsY](/reference/api/utils/) documentation |
|
|
|
|
| `beamsIntersect` | See the [beamsIntersect](/reference/api/utils/beamsintersect) documentation |
|
|
|
|
| `capitalize` | See the [capitalize](/reference/api/utils/capitalize) documentation |
|
|
|
|
| `circlesIntersect` | See the [circlesIntersect](/reference/api/utils/circlesintersect) documentation |
|
|
|
|
| `curveEdge` | See the [curveEdge](/reference/api/utils/curveedge) documentation |
|
|
|
|
| `curveIntersectsX` | See the [curveIntersectsX](/reference/api/utils/curveintersectsX) documentation |
|
|
|
|
| `curveIntersectsY` | See the [curveIntersectsY](/reference/api/utils/curveintersectsY) documentation |
|
|
|
|
| `curvesIntersect` | See the [curvesIntersect](/reference/api/utils/curvesintersect) documentation |
|
|
|
|
| `deg2rad` | See the [deg2rad](/reference/api/utils/deg2rad) documentation |
|
|
|
|
| `generateStackTransform` | see the [generateStackTransform](/reference/api/utils/generateStackTransform) documentation |
|
|
|
|
| `lineIntersectsCircle` | See the [lineIntersectsCircle](/reference/api/utils/lineintersectsCircle) documentation |
|
|
|
|
| `lineIntersectsCurve` | See the [lineIntersectsCurve](/reference/api/utils/lineintersectsCurve) documentation |
|
|
|
|
| `linesIntersect` | See the [linesIntersect](/reference/api/utils/linesintersect) documentation |
|
|
|
|
| `pctBasedOn` | See the [pctBasedOn](/reference/api/utils/pctbasedon) documentation |
|
|
|
|
| `pointOnBeam` | See the [pointOnBeam](/reference/api/utils/pointonbeam) documentation |
|
|
|
|
| `pointOnCurve` | See the [pointOnCurve](/reference/api/utils/pointoncurve) documentation |
|
|
|
|
| `pointOnLine` | See the [pointOnLine](/reference/api/utils/pointonline) documentation |
|
|
|
|
| `rad2deg` | See the [rad2deg](/reference/api/utils/rad2deg) documentation |
|
|
|
|
| `splitCurve` | See the [splitCurve](/reference/api/utils/splitcurve) documentation |
|
|
|
|
| `stretchToScale` | See the [stretchToScale](/reference/api/utils/stretchtoscale) documentation |
|
|
|
|
| `units` | See the [units](/reference/api/utils/units) documentation |
|
|
|
|
|