1
0
Fork 0
freesewing/markdown/dev/reference/api/pattern/sample/en.md
Joost De Cock b34a2ee2ed feat: Flat import of markdown repo
This is a flat (without history) import of (some of) the content
from our markdown module.

We've imported this without history because the repo contains our
blog posts and showcases posts content prior to porting them to strapi.

Since this contains many images, it would balloon the size of this repo
to import the full history.

Instead, please refer to the history of the (archived) markdown repo
at: https://github.com/freesewing/markdown
2021-08-25 16:09:31 +02:00

36 lines
1.1 KiB
Markdown

---
title: sample()
---
```js
Pattern pattern.sample()
```
This method calls either [sampleOption()](#sampleoption),
[sampleMeasurement()](#samplemeasurement),
or [sampleModels()](#samplemodels).
Unlike those three methods who you need to pass the relevant info to,
[sample()](#pattern-sample) will read the `pattern.settings.sample`
object to determine what to do.
The possiblities are:
- **type**: One of `option`, `measurement`, or `models`
- **option**: An option name as defined in the pattern config file (only used when `type` is option).
- **measurement**: A measurement name as defined in the pattern config file (only used when `type` is measurement).
- **models**: An array of models with the required measurements for this pattern (only used when `type` is models).
See the specific sample methods below for more details.
<Tip>
###### Anchor your samples
If you add a point named `anchor` to your pattern part, the different samples
will be anchored on this point.
In other words, for each sample, the anchor point will be kept in the same location.
</Tip>