1
0
Fork 0
freesewing/markdown/dev/reference/api/pattern/sampleoption/en.md

43 lines
1.2 KiB
Markdown
Raw Normal View History

---
title: Pattern.sampleOption()
---
2022-09-20 18:09:28 +02:00
The `Pattern.sampleOption()` 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, the variants it drafts depend
on [the type of option](/config/options/):
2021-09-25 17:05:18 +02:00
- 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
2021-09-25 17:05:18 +02:00
2022-09-20 18:09:28 +02:00
<Fixme>Handle other option types</Fixme>
2021-09-25 17:05:18 +02:00
<Tip>
The goal of option sampling is to verify the impact of an option on the pattern, and verify that
its min and max boundaries are correct and its default value is sensible.
</Tip>
<Note>This method is chainable as it returns the Pattern object</Note>
## Pattern.sampleOption() signature
```js
Pattern pattern.sampleOption(string option)
2022-02-19 08:04:25 +01:00
```
2021-09-25 17:05:18 +02:00
## Pattern.sampleOption() example
```js
2022-09-20 18:09:28 +02:00
import { Aaron } from "@freesewing/aaron"
import { cisFemaleAdult34 } from "@freesewing/models"
2022-09-20 18:09:28 +02:00
const pattern = new Aaron({
measurements: cisFemaleAdult34
})
2022-09-20 18:09:28 +02:00
const svg = pattern.draft().sampleMeasurement('chest')
2022-02-19 08:04:25 +01:00
```