1
0
Fork 0
freesewing/sites/dev/docs/reference/macros
2025-05-24 12:07:19 +02:00
..
banner chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
bannerbox chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
bartack chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
bartackalong chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
bartackfractionalong chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
crossbox chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
cutonfold chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
flip chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
gore chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
grainline chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
hd chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
hem Merge branch 'develop' into cdocs 2025-05-24 12:07:19 +02:00
join Merge branch 'develop' into cdocs 2025-05-24 12:07:19 +02:00
ld chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
miniscale chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
mirror chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
offset Merge branch 'develop' into cdocs 2025-05-24 12:07:19 +02:00
pd chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
pleat chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
ringsector chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmad chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmahd chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmald chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmapd chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmavd chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmbanner chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmbannerbox chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmbartack chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmbartackalong chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmbartackfractionalong chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmcrossbox chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmcutonfold chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmgrainline chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmhd chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmld chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmminiscale chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmpd chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmpleat chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmringsector chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmscalebox chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmsewtogether chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmtitle chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
rmvd chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
round chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
sa Merge branch 'develop' into cdocs 2025-05-24 12:07:19 +02:00
scalebox chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
sewtogether chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
sprinkle chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
title chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
vd chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00
readme.mdx chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00

---
title: Macros
---

Macros are a way to combine different operations into a single command.
Macros are typically provided by by plugins, but can also be added ad-hoc
without the need for a plugin.

## Signature

```js
null macro(object config, object props)
```

A macro receives a single configuration object as its first parameter.
The second parameter is the same object received by [the draft method in a
part](/reference/api/part/draft)

## Example

```js
pattern.use({
  name: 'My adhoc plugin',
  macros: {
    myMacro: function (so, props) {
      // Do something wonderful here
    },
    myOtherMacro: function (so, props) {
      // Do something wonderful here
    },
  }
}
```

Now you can use these macros in your part:

```js
({ macro, part }) => {

  macro('myMacro', {
    some: [ 'config', 'here' ],
    more: 'config'
  })
  macro('myOtherMacro', 'Just a string')

  return part
}
```

## Removing macros and the role of the macro id

Many macros accept an `id` parameter as part of their configuration.  This `id`
is used to generate the names for paths, points, or snippets that are added to
the part by the macro.  This way, macro-added content is deterministic, and can
be removed again.

Each macro typically has an `rm`-prefixed counterpart that removes the (changed
done by) the macro.  For example, you can add a bartack with the `bartack`
macro, and it can be removed with the `rmbartack` macro.  For this removal to
work, and id must be set in the macro, and it must be passed when removing the
macro.

For macros that are typically used once per part (such as the `title` macro)
you can rely on the default id.  For macros typically used multiple times (such
as the various dimension macros) you should set an id that is unique within the
part for each invocation.

## Macros we maintain

Below is a list of macros from [the plugins we maintain](/reference/plugins).

:::note

We use camelCase here, but macro names are case-insensitive
:::

<ReadMore />