2023-10-21 14:48:06 +02:00
|
|
|
---
|
|
|
|
title: Pattern.draftPartForSet()
|
|
|
|
---
|
|
|
|
|
2024-02-02 10:05:59 -08:00
|
|
|
A pattern's `draftPartForSet()` method will draft a part using a
|
|
|
|
given set of settings.
|
|
|
|
|
2024-09-29 07:14:59 +02:00
|
|
|
:::note
|
|
|
|
This method is chainable as it returns the Pattern object
|
|
|
|
:::
|
2024-02-02 10:05:59 -08:00
|
|
|
|
|
|
|
## Pattern.draftPartForSet() signature
|
|
|
|
|
|
|
|
```js
|
|
|
|
Pattern pattern.draftPartForSet(part, set)
|
|
|
|
```
|
|
|
|
|
|
|
|
## Pattern.draftPartForSet() example
|
|
|
|
|
|
|
|
```js
|
2024-09-29 07:14:59 +02:00
|
|
|
import { Aaron } from '@freesewing/aaron'
|
2024-02-02 10:05:59 -08:00
|
|
|
|
|
|
|
// Load a public test settings set from the FreeSewing backend
|
2024-09-29 07:14:59 +02:00
|
|
|
const set = await (await fetch('https://backend3.freesewing.org/curated-sets/1.json')).json()
|
2024-02-02 10:05:59 -08:00
|
|
|
|
|
|
|
const pattern = new Aaron()
|
|
|
|
|
|
|
|
for (const part in pattern.parts) {
|
|
|
|
const svg = pattern.draftPartForSet(part, set).render()
|
|
|
|
}
|
|
|
|
```
|