1
0
Fork 0

Merge branch 'develop' into eriese-v3-printing

This commit is contained in:
Enoch Riese 2022-12-12 09:44:25 -06:00
commit d78b2bb6c1
54 changed files with 869 additions and 645 deletions

View file

@ -3,7 +3,7 @@ title: Loading plugins
order: 140
---
Plugins can be loaded at build time and added to the desig. Or at run time and added to an instantiated pattern.
Plugins can be loaded at build time and added to the design. Or at run time and added to an instantiated pattern.
To load a plugin at build time, it should be added to [the `plugins` key of the part configuration](/reference/api/part/config/plugins).

View file

@ -10,7 +10,7 @@ measurements respectively.
## measurements
The `measurements` property should hold the (named of the) measurements
The `measurements` property should hold the names of the measurements
that are required to draft the current part.
```js
@ -23,7 +23,7 @@ const part = {
## optionalMeasurements
The `optionalMeasurements` property should hold the (named of the) measurements
The `optionalMeasurements` property should hold the names of the measurements
that are optional to draft the current part.
```js

View file

@ -10,7 +10,7 @@ Counters are for integers only. Things like number of buttons and so on.
Your counter option should be a plain object with these properties:
- `count` : The default integer value
- `min` : The minimal integer value that's allowed
- `min` : The minimum integer value that's allowed
- `max` : The maximum integer value that's allowed
<Tip>

View file

@ -9,7 +9,7 @@ For angles, use a degree option.
Your degree option should be a plain object with these properties:
- `deg` : The default value in degrees
- `min` : The minimul that's allowed
- `min` : The minimum that's allowed
- `max` : The maximum that's allowed
<Tip>
@ -29,8 +29,8 @@ more details.
options: {
collarAngle: {
deg: 85,
min: 60
max: 130
min: 60,
max: 130,
}
}
```

View file

@ -68,4 +68,4 @@ percentage options][snapped] instead.
[list]: /reference/api/part/config/options/list
[pct]: /reference/api/part/config/options/pct
[snapped]: /reference/api/part/config/options/pct/snap
[mm]: /reference/api/part/config/options/pct/mm
[mm]: /reference/api/part/config/options/mm

View file

@ -30,10 +30,10 @@ options: {
dflt: "angledBarrelCuff",
list: [
"roundedBarrelCuff",
"angledBarrelCuff"
"straightBarrelCuff"
"roundedFrenchCuff"
"angledFrenchCuff"
"angledBarrelCuff",
"straightBarrelCuff",
"roundedFrenchCuff",
"angledFrenchCuff",
"straightFrenchCuff"
]
}

View file

@ -2,16 +2,20 @@
title: Millimeter options
---
<Warning>
While FreeSewing supports millimeter options, we recommend
using [percentage options][1] and will not accept
contributions that use millimeter options.
</Warning>
## Structure
A millimeter option should be a plain object with these properties:
- `mm` : The default value in millimeter
- `min` : The minimul that's allowed
- `mm` : The default value in millimeters
- `min` : The minimum that's allowed
- `max` : The maximum that's allowed
## Example

View file

@ -64,9 +64,9 @@ You can unlock those features by adding the following properties to your option:
- `toAbs`: A method to [return the option value in millimeter][toabs]
- `snap`: The configuration to control [snapping of percentage options][snap]
[fromabs]: /reference/api/config/options/pct/fromabs
[toabs]: /reference/api/config/options/pct/toabs
[snap]: /reference/api/config/options/pct/snap
[fromabs]: /reference/api/part/config/options/pct/fromabs
[toabs]: /reference/api/part/config/options/pct/toabs
[snap]: /reference/api/part/config/options/pct/snap
Refer to the relevant documentation for more details:

View file

@ -91,4 +91,4 @@ it will also add a `toAbs()` method that does the inverse: return the
value in millimeter of whatever percentage the option is set to.
See [Reporting a percentage option value in
millimeter](/reference/api/config/options/pct/toabs) for details.
millimeter](/reference/api/part/config/options/pct/toabs) for details.

View file

@ -90,7 +90,7 @@ of numbers.
The difference is that this allows you to supply a different list of snap values
for users using metric or imperial units.
In the example below, the value of [settings.units](/api/settings/units) will
In the example below, the value of [settings.units](/reference/settings/units) will
determine which list of snap values gets used.
Then, if the absolute value returned by `toAbs()` is in the

View file

@ -81,4 +81,4 @@ also add a `fromAbs()` method that does the inverse: return the percentage of
any millimeter value passed into it.
See [Setting a value in millimeter as a
percentage option](/api/config/options/pct/fromabs) for details.
percentage option](/reference/api/part/config/options/pct/fromabs) for details.

View file

@ -34,7 +34,7 @@ access the following properties:
|| **_Access to utilities_** |
| `getId` | See [the getId documentation](/reference/api/part/getid) |
| `hide` | See [the hide documentation](/reference/api/part/hide) |
| `log` | See [the logging documentation](reference/api/store/logs) |
| `log` | See [the logging documentation](/reference/api/store/log) |
| `macro` | See [the macros documentation](/reference/macros/) |
| `setHidden` | See [the setHidden documentation](/reference/api/part/sethidden) |
| `store` | See [the store documentation](/reference/api/store) |

View file

@ -22,6 +22,11 @@ Path path.move(Point to)
paths.noline = new Path().move(points.to)
// Prevents clipping
paths.diag = new Path()
.move(new Point(40,19))
.move(new Point(70,21))
return part
}
```

View file

@ -2,7 +2,7 @@
title: Path.setText()
---
The `Path.addText()` method set text on the path.
The `Path.setText()` method sets text on the path.
## Signature
@ -25,7 +25,7 @@ The second argument will optionally be used to set the CSS class for the text.
paths.line = new Path()
.move(points.from)
.line(points.to)
.addText('FreeSewing rocks')
.setText('FreeSewing rocks')
return part
}

View file

@ -71,9 +71,11 @@ It just so happens that in most cases, there will be only one settings object in
- `Pattern.activePart`: Holds the id of the active part (while drafting)
- `Pattern.activeSet`: Holds the id of the active set (while drafting)
- `Pattern.designConfig`: Holds the design's configuration
- `Pattern.designConfig`: Holds the design's configuration
- `Pattern.patternConfig`: Holds the pattern's configuration
- `Pattern.config`: Holds the resolved pattern's configuration
- `Pattern.designConfig`: Holds the design's configuration before resolution
- `Pattern.parts`: Holds the parts used in the pattern
- `Pattern.plugins`: Holds the plugins used in the pattern
- `Pattern.settings`: Holds the settings used for the pattern
- `Pattern.store`: Holds the pattern-wide Store
- `Pattern.setStores`: Holds an array of stores, one for each set of settings.

View file

@ -10,7 +10,7 @@ housekeeping tasks that are typically done behind the scenes when you call
return a Pattern's internal configuration.
You can use this to see what options a pattern provides, what
measurments it requires, and so on.
measurements it requires, and so on.
## Pattern.getConfig() signature

View file

@ -18,7 +18,7 @@ Pattern pattern.on(string hook, function method)
<Tip>
Refer to [the Lifecycle hooks documentation](/reference/hooks/) for a list
of all avaialble lifecycle hooks, as well as the signature of the function you
of all availalble lifecycle hooks, as well as the signature of the function you
should pass it.
</Tip>

View file

@ -9,9 +9,9 @@ top of each other.
<Note>This method is chainable as it returns the Pattern object</Note>
Under the hood, this method will call one of
[Pattern.sampleOption()](/reference/apu/pattern/sampleoption),
[Pattern.sampleMeasurement()](/reference/apu/pattern/sampleoption), or
[Pattern.sampleModels()](/reference/apu/pattern/sampleoption) to sample
[Pattern.sampleOption()](/reference/api/pattern/sampleoption),
[Pattern.sampleMeasurement()](/reference/api/pattern/samplemeasurement), or
[Pattern.sampleModels()](/reference/api/pattern/samplemodels) to sample
an option, a measurement, or different models respectively.
Unlike those three methods where you pass the relevant info to to the method,
@ -27,9 +27,9 @@ The `settings.sample` object can hold the following properties:
See the specific sample methods below for more details:
- [Pattern.sampleOption()](/reference/apu/pattern/sampleoption)
- [Pattern.sampleMeasurement()](/reference/apu/pattern/sampleoption)
- [Pattern.sampleModels()](/reference/apu/pattern/sampleoption)
- [Pattern.sampleOption()](/reference/api/pattern/sampleoption)
- [Pattern.sampleMeasurement()](/reference/api/pattern/samplemeasurement)
- [Pattern.sampleModels()](/reference/api/pattern/samplemodels)
## Pattern.sample() signature

View file

@ -57,5 +57,5 @@ import { cisFemaleAdult } from "@freesewing/models"
const Aaron = new Aaron()
const svg = aaron.sampleModels(cisFemaleAdult, "34').render()
const svg = aaron.sampleModels(cisFemaleAdult, "34").render()
```

View file

@ -7,13 +7,13 @@ to draft multiple variants of the same pattern, and stack them on
top of each other.
In this particular case, the variants it drafts depend
on [the type of option](/config/options/):
on [the type of option](/reference/api/part/config/options/):
- For options that are an object with a **min** and **max** property, 10 steps will be sampled, between min and max
- For options that are a numeric value (**constants**), 10 steps will be sampled between 90% and 110% of the value
- For options with a **list** of options, each option in the list will be sampled
<Fixme>Handle other option types</Fixme>
- For a Percentage or Degree option, 10 steps will be sampled, between min and max
- For a Counter or Millimeter option, a maximum of 10 steps will be sampled, between min and max
- For a Constant numeric option, 10 steps will be sampled between 90% and 110% of the value
- For a List option, each option in the list will be sampled
- For a Boolean option, both `false` and `true` will be sampled
<Tip>
The goal of option sampling is to verify the impact of an option on the pattern, and verify that
@ -38,5 +38,5 @@ const pattern = new Aaron({
measurements: cisFemaleAdult34
})
const svg = pattern.draft().sampleMeasurement('chest')
const svg = pattern.draft().sampleOption('backlineBend')
```

View file

@ -26,6 +26,11 @@ float point.dy(Point point)
.setClass("dotted")
.setText(units(points.from.dy(points.to)), 'center')
// Prevents clipping
paths.diag = new Path()
.move(new Point(-10,40))
.move(new Point(60,10))
return part
}
```

View file

@ -21,7 +21,7 @@ Point objects come with the following properties:
- `x` : The X-coordinate of the point
- `y` : The Y-coordinate of the point
- `attributes` : An [Attributes](../attributes) instance holding the point's attributes
- `attributes` : An [Attributes](/reference/api/attributes) instance holding the point's attributes
## Example

View file

@ -16,7 +16,7 @@ Point point.rotate(float angle, Point center)
## Example
<Example caption="An example of the4Point.rotate() method">
<Example caption="An example of the Point.rotate() method">
```js
({ Point, points, Path, paths, Snippet, snippets, part }) => {

View file

@ -25,7 +25,7 @@ Point point.setCircle(
## Example
<Example caption="Examples of Point.setCircle(), compare this to [Point.addCircle](/reference/api/point/addcircle)">
<Example caption="Examples of Point.setCircle(), compare this to [Point.addCircle()](/reference/api/point/addcircle)">
```js
({ Point, points, part }) => {

View file

@ -19,7 +19,7 @@ Point point.setText(
## Example
<Example caption="Examples of Point.setText(), compare this to [Point.setText](/reference/api/point/settext)">
<Example caption="Examples of Point.setText(), compare this to [Point.setText()](/reference/api/point/settext)">
```js
({ Point, points, Path, paths, part }) => {

View file

@ -32,7 +32,7 @@ will run `myCustomMethod()`.
## Methods
A Store object exposes the following methods:
A Store object exposes the following methods and properties:
<ReadMore list />
@ -42,4 +42,6 @@ A store is typically used to share information between parts. For example
the length of the neck opening in one part can be used to calculate the
length for the collar in another part.
<Fixme compact>Include link to guide</Fixme>
Click below to learn more about:
- [How Stores work](/guides/patterns/store)

View file

@ -15,5 +15,5 @@ null hook(Svg svg)
The `postRender` hook is rarely used, but it's there if you need it.
Like the `preRender` hook, it receives [the SVG object](/api/svg) as its first
Like the `preRender` hook, it receives [the SVG object](/reference/api/svg) as its first
parameter.

View file

@ -16,5 +16,5 @@ null hook(Svg svg)
The `preRender` hook is typically used to change the result of the render, for
example by adding CSS to the SVG output.
Like the `postRender` hook, it receives [the SVG object](/api/svg) as its first
Like the `postRender` hook, it receives [the SVG object](/reference/api/svg) as its first
parameter.

View file

@ -50,3 +50,9 @@ macro('banner', {
| `dy` | `1` | `number` | Controls how far the text will be located above the path |
| `spaces` | `12` | `number` | The number of spaces to place between repetitions |
| `repeat` | `10` | `number` | The number of repetitions |
## Notes
Under the hood, this macro will:
- Add `data-text`, `data-text-dy`, and `data-text-class` Attributes to the path to generate the text.

View file

@ -43,6 +43,12 @@ macro('banner', {
| `angle` | `0` | `number` | The angle under which to draw the bartack |
| `density` | `3` | `number` | Controls how close the stitches are togeter |
| `length` | `15` | `number` | Length of the bartack |
| `prefix` | | `string` | A prefix to apply to the names of the generated path and points |
| `suffix` | | `string` | A suffix to apply to the names of the generated path and points |
| `prefix` | | `string` | A prefix to apply to the name of the generated path |
| `suffix` | | `string` | A suffix to apply to the name of the generated path |
| `width` | `3` | `number` | Width of the bartack |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}bartack${suffix}` | Path generated for the bartack marker |

View file

@ -49,6 +49,12 @@ macro('banner', {
| `density` | `3` | `number` | Controls how close the stitches are togeter |
| `length` | `15` | `number` | Length of the bartack |
| `path` | | `Path` | The path the bartack should follow |
| `prefix` | | `string` | A prefix to apply to the names of the generated path and points |
| `suffix` | | `string` | A suffix to apply to the names of the generated path and points |
| `prefix` | | `string` | A prefix to apply to the name of the generated path |
| `suffix` | | `string` | A suffix to apply to the name of the generated path |
| `width` | `3` | `number` | Width of the bartack |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}bartack${suffix}` | Path generated for the bartack marker |

View file

@ -54,7 +54,13 @@ macro('banner', {
| `end` | `1` | `number` | At which fraction of the path length (from `0` to `1`) should the bartack end |
| `length` | `15` | `number` | Length of the bartack |
| `path` | | `Path` | The path the bartack should follow |
| `prefix` | | `string` | A prefix to apply to the names of the generated path and points |
| `prefix` | | `string` | A prefix to apply to the name of the generated path |
| `start` | `0` | `number` | At which fraction of the path length (from `0` to `1`) should the bartack start |
| `suffix` | | `string` | A suffix to apply to the names of the generated path and points |
| `suffix` | | `string` | A suffix to apply to the name of the generated path |
| `width` | `3` | `number` | Width of the bartack |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}bartack${suffix}` | Path generated for the bartack marker |

View file

@ -22,7 +22,7 @@ macro('cutonfold', {
<Example caption="Example of the cut on fold indicator added by this macro">
```js
({ Point, macro, part }) => {
({ Point, macro, Path, paths, part }) => {
macro('cutonfold', {
from: new Point(0,0),
@ -30,6 +30,11 @@ macro('cutonfold', {
grainline: true
})
// Prevent clipping
paths.diag = new Path()
.move(new Point(-10,-20))
.move(new Point(110,0))
return part
}
```
@ -43,8 +48,19 @@ macro('cutonfold', {
| `to` | | [Point](/reference/api/point) | The endpoint of the _cut on fold_ indicator |
| `margin` | 5 | [Point](/reference/api/point) | The distance in % to keep from the start/end edge |
| `offset` | 15 | Number | The distance in mm to offset from the line from start to end |
| `prefix` | | String | A prefix to apply to the names of the generated path and points |
| `grainline` | `false` | Boolean | Whether this cutonfold indicator is also the grainline |
## Result
| Generated Element | Description |
|------|-------------|
| `paths.cutonfold${prefix}` | The Path for the _cut on fold_ indicator |
| `points.cutonfoldFrom${prefix}` | Point used to create the path |
| `points.cutonfoldVia1${prefix}` | Point used to create the path |
| `points.cutonfoldVia2${prefix}` | Point used to create the path |
| `points.cutonfoldTo${prefix}` | Point used to create the path |
## Notes
### It's safe to use a corner of your pattern part for this

View file

@ -46,4 +46,4 @@ Under the hood, this macro will:
- Go through all Points in your Part, and multiply their (X or Y)-coordinate by -1
- Go through all the Paths in your Part, and for each drawing operation will multiply the (X or Y)-coordinare by -1
- Go through all the Snippets in your Part and multiply the (X or Y)-coordinate of the anchor point by -1
- Add a 'flipped` Attribute to Points and Paths to keep track of the number of times they have been flipped (to avoid issues when multiple flips are performed)

View file

@ -2,8 +2,7 @@
title: gore
---
The `gore` macro facilitates the drafting of [gores][1] which are typically
used in hats.
The `gore` macro facilitates the drafting of [gores][1] to create spherical or other roundish objects. They are are typically used in hats.
It is provided by the [gore plugin](/reference/plugins/grainline/).
## Signature
@ -16,6 +15,7 @@ macro('gore', {
Number extraLength,
Boolean hidden=true,
String class='',
String prefix='',
)
```
@ -45,10 +45,22 @@ macro('gore', {
|--------------:|---------|------------|----------------------------------------------|
| `from` | | [Point][2] | The point to start drafting the gore from |
| `radius` | | number | The radius of the sphere the gores should cover |
| `gores` | | number | The text to put on the _grainline_ indicator |
| `gores` | | number | The number of gores into which the sphere is divided |
| `extraLength` | | number | The length of the straight section after a complete semisphere |
| `hidden` | `true` | boolean | Whether or not to hide the generated path |
| `class` | | boolean | Any classes to add to the generated path |
| `prefix` | | string | A prefix to apply to the names of the generated path and points |
## Result
| Generated Element | Description |
|------|-------------|
| `paths.${prefix}seam` | The Path for the gore |
| `points.${prefix}p1` | Point for the gore tip |
| `points.${prefix}p2` | Point between the tip and side corner |
| `points.${prefix}p3` | Point for the gore side corner |
| `points.${prefix}Cp1` | Control Point used to create the curved path |
| `points.${prefix}Cp2` | Control Point used to create the curved path |
[1]: https://en.wikipedia.org/wiki/Gore_\(segment\)

View file

@ -19,19 +19,23 @@ macro('grainline', {
<Example caption="Example of the grainline indicator added by this macro">
```js
({ Point, macro, part }) => {
({ Point, macro, Path, paths, part }) => {
macro('grainline', {
from: new Point(0,0),
to: new Point(100,0),
})
// Prevent clipping
paths.diag = new Path()
.move(new Point(-20,-10))
.move(new Point(110, 0))
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
@ -40,6 +44,14 @@ macro('grainline', {
| `to` | | [Point][1] | The endpoint of the _grainline_ indicator |
| `text` | 'grainline' | string | The text to put on the _grainline_ indicator |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.grainline` | The Path for the _grainline_ indicator |
| `points.grainlineFrom` | Point used to create the path |
| `points.grainlineTo` | Point used to create the path |
[1]: /reference/api/point
## Notes

View file

@ -11,7 +11,7 @@ It is provided by the [dimension plugin](/reference/plugins/dimension/).
macro('hd', {
String id,
Point from,
Boolean noEndtMarker,
Boolean noEndMarker,
Boolean noStartMarker,
String text,
Point to,
@ -43,11 +43,19 @@ macro('hd', {
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `y` | | Number | The Y-value at which to draw the dimension |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created |
| `id` | auto-assigned | String | A custom ID under which paths and points will be created |
| `text` | Horizontal distance | Number | The text to go on the dimension if not the from-to horizontal distance |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${id}` | Path for the span of the dimension |
| `paths.${id}_ls` | Path for the leader to the start of the dimension |
| `paths.${id}_le` | Path for the leader to the end of the dimension |
## Notes
Setting a custom ID will:

View file

@ -12,7 +12,7 @@ macro('ld', {
Number d,
String id,
Point from,
Boolean noEndtMarker,
Boolean noEndMarker,
Boolean noStartMarker,
String text,
Point to,
@ -39,15 +39,23 @@ macro('ld', {
## Configuration
| Property | Default | Type | Description |
|-----------------|---------|---------------------|-------------|
|----------------:|---------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint of the dimension |
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `d` | 0 | Number | The offset at which to draw the dimension |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created |
| `id` | auto-assigned | String | A custom ID under which paths and points will be created |
| `text` | Linear distance | Number | The text to go on the dimension if not the from-to linear distance |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${id}` | Path for the span of the dimension |
| `paths.${id}_ls` | Path for the leader to the start of the dimension |
| `paths.${id}_le` | Path for the leader to the end of the dimension |
## Notes
Setting a custom ID will:

View file

@ -4,6 +4,8 @@ title: miniscale
The `miniscale` macro adds a mini _scale box_ to your pattern. This box allows
users to verify their pattern is printed to scale.
The white inside of the box provides a metric scale, and the black outside
of the box provides an imperial scale.
The `miniscale` macro is provided by the [scalebox plugin](/reference/plugins/scalebox).
It is the mini version of [the scalebox macro](/reference/macros/scalebox/).
@ -35,10 +37,20 @@ macro('miniscale', {
## Configuration
| Property | Default | Type | Description |
|-------------|---------|---------------------|-------------|
|------------:|---------|---------------------|-------------|
| `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on |
| `rotate` | 0 | Number | Rotation in degrees |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.__miniscaleImperial` | Path of the imperial, outer box |
| `paths.__miniscaleMetric` | Path of the metric, inner box |
| `points.__miniscaleImperial` | Point anchoring the imperial text |
| `points.__miniscaleMetric` | Point anchoring the metric text |
| `points.__miniscale[Metric/Imperial][Top/Bottom][Left/Right]` | Points for the corners of the boxes |
## Notes
If you inherit a part with a miniscale on it and you'd like to remove all

View file

@ -53,7 +53,17 @@ macro('mirror', {
|-------------:|------------|------------|-------------|
| `mirror` | | `array` | Array with 2 [Point](/reference/api/point) objects that define the _mirror line_ |
| `clone` | `true` | `bool` | Whether to clone mirrored points and or paths |
| `points` | | `array` | An array of [Point](/reference/api/point) objects |
| `paths` | | `array` | An array of [Path](/reference/api/path) objects |
| `points` | | `array` | An array of pointnames, the names of Points in the `points` array to mirror |
| `paths` | | `array` | An array of pathnames, the names of Paths in the `paths` array to mirror |
| `prefix` | `mirrored` | `string` | A prefix to apply to the names of the clones points and or paths. Ignored if `nameFormat` is set |
| `nameFormat` | | `function` | A method that receives the name of the path or point and should return the name for the cloned path and or point |
## Result
If `nameFormat` is set, its method determines the names of cloned, mirrored Points and Paths.
If it is not set, the names are as below.
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}${Pathname}` | The cloned, mirrored Path(s) (with the first letter of pathname capitalized) |
| `points.${prefix}${Pointname}` | The cloned, mirrored Point(s) (with the first letter of pointname capitalized) |

View file

@ -13,7 +13,7 @@ macro('pd', {
Number d,
String id,
Path path,
Boolean noEndtMarker,
Boolean noEndMarker,
Boolean noStartMarker,
String text,
})
@ -44,12 +44,20 @@ macro('pd', {
| Property | Default | Type | Description |
|----------------:|---------|---------------------|-------------|
| `path` | | [Path](/reference/api/path) | The path to draw the dimension along |
| `d` | 0 | Number | The offset at which to draw the dimension |
| `d` | 10 | Number | The offset at which to draw the dimension |
| `text` | Path length | Number | The text to go on the dimension if not the length of the path |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created |
| `id` | auto-assigned | String | A custom ID under which paths and points will be created |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${id}` | Path for the span of the dimension |
| `paths.${id}_ls` | Path for the leader to the start of the dimension |
| `paths.${id}_le` | Path for the leader to the end of the dimension |
## Notes
Setting a custom ID will:

View file

@ -2,7 +2,7 @@
title: round
---
The `round` macro rounds a corner. It is provided by the [round
The `round` macro creates a rounded corner. It is provided by the [round
plugin](/reference/plugins/round/).
## Signature
@ -44,12 +44,22 @@ macro('round', {
|------------:|---------|---------------------|-------------|
| `from` | | [Point](/reference/api/point) | The startpoint towards the corner to round |
| `to` | | [Point](/reference/api/point) | The endpoint away from the corner to round |
| `via` | | [Point](/reference/api/point) | The corner to round |
| `radius` | Maximum | Number | The radius in mm in not the maximum |
| `via` | | [Point](/reference/api/point) | The cornerpoint to round |
| `radius` | Maximum | Number | The radius in mm if not the maximum possible |
| `prefix` | | String | A prefix to give to the points and paths created by this macro |
| `hide` | `true` | Boolean | Whether to hide the path created by this macro |
| `class` | | String | Class(es) to assign to the path created by this macro |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${prefix}Rounded` | Path for the rounded corner |
| `points.${prefix}Start` | Point for the start of the rounded corner |
| `points.${prefix}End` | Point for the end of the rounded corner |
| `points.${prefix}Cp1` | Control Point used to create the curved path |
| `points.${prefix}Cp2` | Control Point used to create the curved path |
## Notes
This macro is only intended for 90 degree corners.

View file

@ -4,6 +4,8 @@ title: scalebox
The `scalebox` macro adds a _scale box_ to your pattern. This box allows users
to verify their pattern is printed to scale.
The white inside of the box provides a metric scale, and the black outside
of the box provides an imperial scale.
The `scalebox` macro is provided by the [scalebox
plugin](/reference/plugins/scalebox).
@ -40,7 +42,7 @@ macro('scalebox', {
## Configuration
| Property | Default | Type | Description |
|-------------|---------|---------------------|-------------|
|------------:|---------|---------------------|-------------|
| `at` | | [Point](/reference/api/point) | The point to anchor the _scale box_ on |
| `lead` | FreeSewing | String | The lead text above the title |
| `title` | _pattern name + version_ | String | The title text |
@ -49,6 +51,19 @@ macro('scalebox', {
(\*) `freesewingIsMadeByJoostDeCockAndContributors \n withTheFinancialSupportOfOurPatrons`
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.__scaleboxImperial` | Path of the imperial, outer box |
| `paths.__scaleboxMetric` | Path of the metric, inner box |
| `points.__scaleboxLead` | Point anchoring the lead text above the title |
| `points.__scaleboxTitle` | Point anchoring the title text |
| `points.__scaleboxTitle` | Point anchoring the text below the title |
| `points.__scaleboxImperial` | Point anchoring the imperial text |
| `points.__scaleboxMetric` | Point anchoring the metric text |
| `points.__scalebox[Metric/Imperial][Top/Bottom][Left/Right]` | Points for the corners of the boxes |
## Notes
### Removing the scalebox

View file

@ -3,7 +3,7 @@ title: sprinkle
---
The `sprinkle` macro facilitates adding snippets to your pattern in bulk.
It is by the [sprinkle plugin](/reference/plugins/sprinkle).
It is provided by the [sprinkle plugin](/reference/plugins/sprinkle).
## Signature
@ -38,7 +38,7 @@ macro('sprinkle', {
// Prevent clipping
paths.diag = new Path()
.move(points.a)
.move(points.g)
.move(new Point(points.g.x, points.g.y + 5))
return part
}
@ -49,7 +49,13 @@ macro('sprinkle', {
| Property | Default | Type | Description |
|------------:|---------|------------------|-------------|
| `snippet` | | String | Name of the snippet to sprinkle |
| `on` | `[]` | Array of strings | An array with **the names** of points to add the snippet on |
| `scale` | 1 | number | Scale for the individual snippets |
| `rotate` | 0 | number | Rotation for the individual snippets |
| `snippet` | | String | Name of the Snippet to sprinkle |
| `on` | `[]` | Array of strings | Array of pointnames, the names of Points in the `points` array to add the Snippets on |
| `scale` | 1 | number | Scale for the individual Snippets |
| `rotate` | 0 | number | Rotation for the individual Snippets |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `snippets.${pointname}-${snippet}` | The Snippet(s) created |

View file

@ -25,9 +25,10 @@ macro('title', {
```js
({ Point, Path, paths, macro, store, part }) => {
// This is where name/version is supposed to be stored
// This is where name/version/etc. is supposed to be stored
store.set('data.version', 3)
store.set('data.name', 'Example')
store.set('data.for', 'Person')
macro('title', {
nr: 9,
@ -37,8 +38,8 @@ macro('title', {
// Prevent clipping
paths.diag = new Path()
.move(new Point(0,-50))
.move(new Point(80,20))
.move(new Point(-20,-50))
.move(new Point(80,35))
return part
}
@ -56,3 +57,13 @@ macro('title', {
| `append` | `false` | Boolean | Set this to `true` to append the `nr` to any text already set in Point `at`'s attributes, rather than overwrite it |
| `rotation` | 0 | Number | An optional rotation in degrees |
| `scale` | 1 | Number | An optional scaling factor |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `points._${prefix}_titleNr` | Point anchoring the part number text |
| `points._${prefix}_titleName` | Point anchoring the part name text |
| `points._${prefix}_titlePattern` | Point anchoring the pattern name text |
| `points._${prefix}_titleFor` | Point anchoring the name of the person for whom the pattern was made, if that information exists |
| `points._${prefix}_exportDate` | Point anchoring the pattern export date |

View file

@ -11,7 +11,7 @@ It is provided by the [dimension plugin](/reference/plugins/dimension/).
macro('vd', {
String id,
Point from,
Boolean noEndtMarker,
Boolean noEndMarker,
Boolean noStartMarker,
String text,
Point to,
@ -23,7 +23,7 @@ macro('vd', {
<Example caption="An example of a vertical dimension with the vd macro">
```js
({ Point, macro, part }) => {
({ Point, macro, Path, paths, part }) => {
macro('vd', {
from: new Point(0,0),
@ -31,6 +31,11 @@ macro('vd', {
x:10,
})
// Prevent clipping
paths.diag = new Path()
.move(new Point(-20,0))
.move(new Point(90,40))
return part
}
```
@ -44,10 +49,18 @@ macro('vd', {
| `to` | | [Point](/reference/api/point) | The endpoint of the dimension |
| `x` | | Number | The X-value at which to draw the dimension |
| `text` | Vertical distance | Number | The text to go on the dimension if not the from-to vertical distance |
| `id` | auto-assigned | String | A custom ID under wich paths and points will be created |
| `id` | auto-assigned | String | A custom ID under which paths and points will be created |
| `noStartMarker` | `false` | Boolean | Whether to not draw a start marker |
| `noEndMarker` | `false` | Boolean | Whether to not draw an end marker |
## Result
| Generated Element | Description |
|-------------------|-------------|
| `paths.${id}` | Path for the span of the dimension |
| `paths.${id}_ls` | Path for the leader to the start of the dimension |
| `paths.${id}_le` | Path for the leader to the end of the dimension |
## Notes
Setting a custom ID will:

View file

@ -54,8 +54,8 @@ You can see this in practice in our [Carlita][2] pattern, which extends the
menswear [Carlton][3] pattern.
<Related compact>
To learn more about extending a pattern, see [Design
inheritance](/howtos/code/inheritance/)
To learn more about extending a pattern, see [Part
inheritance](/howtos/code/from/)
</Related>
### Use when creating gender-neutral patterns
@ -65,17 +65,17 @@ if they are present — you can use this plugin, but you'll also need a few othe
things:
- You'll need to mark the breast measurements as [optional
measurements](/reference/api/config/optionalmeasurements)
measurements](/reference/api/part/config/measurements#optionalmeasurements)
- You'll need to [conditionally load this
plugin](/guides/plugins/conditionally-loading-build-time-plugins)
plugin](/reference/api/part/config/plugins#conditional-plugins)
You can see an example of this in [our Teagan design][4].
[1]: https://www.npmjs.com/package/@freesewing/plugin-banner
[2]: https://github.com/freesewing/freesewing/blob/develop/designs/carlita/src/index.js#L12
[2]: https://github.com/freesewing/freesewing/blob/develop/designs/carlita/src/index.mjs#L25
[3]: https://github.com/freesewing/freesewing/blob/develop/designs/carlton
[4]: https://github.com/freesewing/freesewing/blob/develop/designs/teagan/src/index.js
[4]: https://github.com/freesewing/freesewing/blob/develop/designs/teagan/src/index.mjs

View file

@ -778,17 +778,18 @@ Pattern.prototype.__isStackHidden = function (stackName) {
}
/**
* Generates an array of settings.options objects for sampling a list option
* Generates an array of settings.options objects for sampling a list or boolean option
*
* @private
* @param {string} optionName - Name of the option to sample
* @return {Array} sets - The list of settings objects
*/
Pattern.prototype.__listOptionSets = function (optionName) {
Pattern.prototype.__listBoolOptionSets = function (optionName) {
let option = this.config.options[optionName]
const base = this.__setBase()
const sets = []
let run = 1
if (typeof option.bool !== 'undefined') option = { list: [false, true] }
for (const choice of option.list) {
const settings = {
...base,
@ -1091,11 +1092,15 @@ Pattern.prototype.__needs = function (partName, set = 0) {
* @return {Array} sets - The list of settings objects
*/
Pattern.prototype.__optionSets = function (optionName) {
let option = this.config.options[optionName]
if (typeof option?.list === 'object') return this.__listOptionSets(optionName)
const sets = []
if (!(optionName in this.config.options)) return sets
let option = this.config.options[optionName]
if (typeof option.list === 'object' || typeof option.bool !== 'undefined')
return this.__listBoolOptionSets(optionName)
let factor = 1
let step, val
let numberRuns = 10
let stepFactor = numberRuns - 1
if (typeof option.min === 'undefined' || typeof option.max === 'undefined') {
const min = option * 0.9
const max = option * 1.1
@ -1103,9 +1108,16 @@ Pattern.prototype.__optionSets = function (optionName) {
}
if (typeof option.pct !== 'undefined') factor = 100
val = option.min / factor
step = (option.max / factor - val) / 9
if (typeof option.count !== 'undefined' || typeof option.mm !== 'undefined') {
const numberOfCounts = option.max - option.min + 1
if (numberOfCounts < 10) {
numberRuns = numberOfCounts
stepFactor = Math.max(numberRuns - 1, 1)
}
}
step = (option.max / factor - val) / stepFactor
const base = this.__setBase()
for (let run = 1; run < 11; run++) {
for (let run = 1; run <= numberRuns; run++) {
const settings = {
...base,
options: {
@ -1117,6 +1129,8 @@ Pattern.prototype.__optionSets = function (optionName) {
settings.options[optionName] = val
sets.push(settings)
val += step
if (typeof option.count !== 'undefined' || typeof option.mm !== 'undefined')
val = Math.round(val)
}
return sets

View file

@ -320,7 +320,7 @@ Point.prototype.sitsRoughlyOn = function (that) {
* Returns slope of a line made by this Point and that Point
*
* @param {Point} that - The Point that forms the line together with this Point
* @return {float} slote - The slope of the line made by this Point and that Point
* @return {float} slope - The slope of the line made by this Point and that Point
*/
Point.prototype.slope = function (that) {
return (that.__check().y - this.__check().y) / (that.x - this.x)

View file

@ -44,7 +44,7 @@ export function beamIntersectsCircle(c, r, p1, p2, sort = 'x') {
}
/**
* Finds qhere an endless line intersects with a given X-value
* Finds where an endless line intersects with a given X-value
*
* @param {Point} from - First Point on the line
* @param {Point} to - Second Point on the line
@ -60,7 +60,7 @@ export function beamIntersectsX(from, to, x) {
}
/**
* Finds qhere an endless line intersects with a given Y-value
* Finds where an endless line intersects with a given Y-value
*
* @param {Point} from - First Point 1 on the line
* @param {Point} to - Second Point on the line
@ -162,7 +162,7 @@ export function circlesIntersect(c1, r1, c2, r2, sort = 'x') {
* @param {BezierJs} curve - A BezierJs curve instance
* @param {string} edge - The edge to find: top, bottom, right, or left
* @param {int} steps - The number of steps to divide the curve in while walking it
* @return {Array} intersecions - An Array of Point objects of all intersections
* @return {Point} edgepoint - A Point object located on the edge of the curve. Returns the first point found, if more than one lies on the edge.
*/
export function curveEdge(curve, edge, steps = 500) {
let x = Infinity
@ -194,7 +194,7 @@ export function curveEdge(curve, edge, steps = 500) {
* @param {Point} cp2 - Control Point at the end of the curve
* @param {Point} to - End Point of the curve
* @param {float} x - X-value to check for intersections
* @return {Array} intersecions - An Array of Point objects of all intersections
* @return {Array} intersections - An Array of Point objects of all intersections
*/
export function curveIntersectsX(from, cp1, cp2, to, x) {
let start = new Point(x, -10000)
@ -210,7 +210,7 @@ export function curveIntersectsX(from, cp1, cp2, to, x) {
* @param {Point} cp2 - Control Point at the end of the curve
* @param {Point} to - End Point of the curve
* @param {float} y - Y-value to check for intersections
* @return {Array} intersecions - An Array of Point objects of all intersections
* @return {Array} intersections - An Array of Point objects of all intersections
*/
export function curveIntersectsY(from, cp1, cp2, to, y) {
let start = new Point(-10000, y)
@ -229,7 +229,7 @@ export function curveIntersectsY(from, cp1, cp2, to, y) {
* @param {Point} cp1B - Control Point at the start of the second curve
* @param {Point} cp2B - Control Point at the end of the second curve
* @param {Point} toB - End Point of the fsecond curve
* @return {Array} intersecions - An Array of Point objects of all intersections between the curves
* @return {Array} intersections - An Array of Point objects of all intersections between the curves
*/
export function curvesIntersect(fromA, cp1A, cp2A, toA, fromB, cp1B, cp2B, toB) {
let precision = 0.005 // See https://github.com/Pomax/bezierjs/issues/99

View file

@ -37,7 +37,7 @@
"lodash.get": "^4.4.2",
"lodash.orderby": "^4.6.0",
"lodash.set": "^4.3.2",
"next": "^13",
"next": "^13.0.0",
"react": "^18.2.0",
"react-copy-to-clipboard": "^5.0.4",
"react-dom": "^18.2.0",

View file

@ -41,13 +41,16 @@
"d3-drag": "^3.0.0",
"d3-selection": "^3.0.0",
"daisyui": "^2.0.6",
"i18next": "^22.4.0",
"lodash.get": "^4.4.2",
"lodash.orderby": "^4.6.0",
"lodash.set": "^4.3.2",
"next": "latest",
"next": "^13.0.0",
"next-i18next": "^13.0.0",
"react": "^18.2.0",
"react-copy-to-clipboard": "^5.0.4",
"react-hotkeys-hook": "^4.0.4",
"react-i18next": "^12.1.1",
"react-instantsearch-dom": "^6.18.0",
"react-markdown": "^8.0.0",
"react-swipeable": "^7.0.0",

View file

@ -40,7 +40,7 @@
"lodash.get": "^4.4.2",
"lodash.orderby": "^4.6.0",
"lodash.set": "^4.3.2",
"next": "latest",
"next": "^13.0.0",
"react-hotkeys-hook": "^4.0.4",
"react-instantsearch-dom": "^6.18.0",
"react-markdown": "^8.0.3",

1076
yarn.lock

File diff suppressed because it is too large Load diff