2021-10-17 18:26:00 +02:00
|
|
|
---
|
|
|
|
title: Pattern.sampleModels()
|
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-20 18:09:28 +02:00
|
|
|
The `Pattern.sampleModels()` method will _sample_ the pattern which means
|
|
|
|
to draft multiple variants of the same pattern, and stack them on
|
|
|
|
top of each other.
|
|
|
|
|
|
|
|
In this particular case, it will draft a variants for each of the models you pass it.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-09-25 17:05:18 +02:00
|
|
|
<Tip>
|
2021-08-25 16:09:31 +02:00
|
|
|
The goal of model sampling is to verify that a pattern grades correctly up and down as sizes change.
|
2021-09-25 17:05:18 +02:00
|
|
|
</Tip>
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-09-25 17:05:18 +02:00
|
|
|
<Note>This method is chainable as it returns the Pattern object</Note>
|
|
|
|
|
|
|
|
## Pattern.sampleModels() signature
|
|
|
|
|
|
|
|
```js
|
|
|
|
Pattern pattern.sampleModels(object models, string focus)
|
2022-02-19 08:04:25 +01:00
|
|
|
```
|
|
|
|
|
2022-09-20 18:09:28 +02:00
|
|
|
The `models` object you pass as the first parameter should be structured as such:
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-09-25 17:05:18 +02:00
|
|
|
```js
|
|
|
|
{
|
|
|
|
modelName1: {
|
|
|
|
measurement1: valueInMm,
|
|
|
|
measurement2: valueInMm,
|
|
|
|
// ...
|
|
|
|
},
|
|
|
|
modelName2: {
|
|
|
|
measurement1: valueInMm,
|
|
|
|
measurement2: valueInMm,
|
|
|
|
// ...
|
|
|
|
},
|
|
|
|
// ...
|
|
|
|
}
|
|
|
|
```
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-02-19 08:04:25 +01:00
|
|
|
The (optional) string you can pass as the second parameter should hold the
|
2021-09-25 17:05:18 +02:00
|
|
|
key of one of the models in the first parameter. In our example above, it
|
|
|
|
could hold `modelName2` for example.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-02-20 14:35:50 +01:00
|
|
|
By passing this second parameter, you can put the _focus_ on one of the models,
|
2022-02-19 08:04:25 +01:00
|
|
|
which will influence the render style, and make it
|
2022-12-14 12:52:37 -08:00
|
|
|
easier to see a comparison between a given set of measurements, and the rest.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-09-25 17:05:18 +02:00
|
|
|
Alternatively, you can use the `Pattern.sample()` method and set `settings.sample.focus` to the key
|
2021-08-25 16:09:31 +02:00
|
|
|
identifying your model in the models object.
|
|
|
|
|
2021-09-25 17:05:18 +02:00
|
|
|
## Pattern.sampleModels() example
|
|
|
|
|
|
|
|
```js
|
2022-09-20 18:09:28 +02:00
|
|
|
import { Aaron } from "@freesewing/aaron"
|
|
|
|
import { cisFemaleAdult } from "@freesewing/models"
|
2021-09-25 17:05:18 +02:00
|
|
|
|
|
|
|
const Aaron = new Aaron()
|
|
|
|
|
2022-12-08 20:40:31 -08:00
|
|
|
const svg = aaron.sampleModels(cisFemaleAdult, "34").render()
|
2022-02-19 08:04:25 +01:00
|
|
|
```
|