1
0
Fork 0

fix(markdown): Restructure part reference. See #2981

This commit is contained in:
Joost De Cock 2022-10-18 21:00:50 +02:00
parent b4eb7e7b00
commit ac7b5befce
10 changed files with 105 additions and 110 deletions

View file

@ -65,12 +65,10 @@ The following named exports are **uitility methods**:
| `beamsIntersect` | See the [beamsIntersect](/reference/api/utils/beamsintersect) documentation |
| `capitalize` | See the [capitalize](/reference/api/utils/capitalize) documentation |
| `circlesIntersect` | See the [circlesIntersect](/reference/api/utils/circlesintersect) documentation |
| `curveEdge` | See the [curveEdge](/reference/api/utils/curveedge) documentation |
| `curveIntersectsX` | See the [curveIntersectsX](/reference/api/utils/curveintersectsx) documentation |
| `curveIntersectsY` | See the [curveIntersectsY](/reference/api/utils/curveintersectsy) documentation |
| `curvesIntersect` | See the [curvesIntersect](/reference/api/utils/curvesintersect) documentation |
| `deg2rad` | See the [deg2rad](/reference/api/utils/deg2rad) documentation |
| `generateStackTransform` | see the [generateStackTransform](/reference/api/utils/generateStackTransform) documentation |
| `lineIntersectsCircle` | See the [lineIntersectsCircle](/reference/api/utils/lineintersectscircle) documentation |
| `lineIntersectsCurve` | See the [lineIntersectsCurve](/reference/api/utils/lineintersectscurve) documentation |
| `linesIntersect` | See the [linesIntersect](/reference/api/utils/linesintersect) documentation |

View file

@ -32,15 +32,16 @@ access the following properties:
| `sa` | Access to `settings.sa` |
| `scale` | Access to `settings.scale` |
|| **_Access to utilities_** |
| `getId` | See [the getId documentation](/refence/api/part/draft/getid) |
| `hide` | See [the hide documentation](/refence/api/part/draft/hide) |
| `log` | See [the logging documentation](referenec/api/store/logs) |
| `getId` | See [the getId documentation](/reference/api/part/getid) |
| `hide` | See [the hide documentation](/reference/api/part/hide) |
| `log` | See [the logging documentation](reference/api/store/logs) |
| `macro` | See [the macros documentation](/reference/macros/) |
| `setHidden` | See [the setHidden documentation](/refence/api/part/draft/sethidden) |
| `setHidden` | See [the setHidden documentation](/reference/api/part/sethidden) |
| `store` | See [the store documentation](/reference/api/store) |
| `unhide` | See [the unhide documentation](/refence/api/part/draft/unhide) |
| `units` | See [the units documentation](/refence/api/part/draft/units) |
| `unhide` | See [the unhide documentation](/reference/api/part/unhide) |
| `units` | A version of [`utils.units()`](/reference/api/utils/units) that is preconfigured with the user's chosenunits |
| `utils` | See [the utils documentation](/reference/api/utils) |
|| **_Return value_** |
| `part` | Your draft method **must** return this |

View file

@ -1,24 +0,0 @@
---
title: hide()
---
Calling `hide()` in a part's draft method will mark the part as hidden.
<Tip>This method returns the `part` object, so it's chainable</Tip>
<Related>
The [unhide](/reference/api/part/draft/unhide) and
[setHidden](/reference/api/part/draft/sethidden) methods also control a
part's visibility
</Related>
## hide() example
```js
cont part = {
name: 'examples.hide',
draft: ({ hide, part }) => part.hide()
}
```

View file

@ -1,28 +0,0 @@
---
title: setHidden()
---
Calling `setHidden()` in a part's draft method will mark the part either hidden
or not, depending on whether you:
- Pass a *truthy* value: part will be hidden
- Pass a *falsy* value: part will be unhidden/revealed
<Tip>This method returns the `part` object, so it's chainable</Tip>
<Related>
The [hide](/reference/api/part/draft/hide) and
[unhide](/reference/api/part/draft/unhide) also control a
part's visibility
</Related>
## setHidden() example
```js
cont part = {
name: 'examples.hide',
draft: ({ setHidden, part }) => part.setHidden(true)
}
```

View file

@ -1,24 +0,0 @@
---
title: unhide()
---
Calling `unhide()` in a part's draft method will mark the part as not hidden.
<Tip>This method returns the `part` object, so it's chainable</Tip>
<Related>
The [hide](/reference/api/part/draft/hide) and
[setHidden](/reference/api/part/draft/sethidden) methods also control a
part's visibility
</Related>
## unhide() example
```js
cont part = {
name: 'examples.hide',
draft: ({ unhide, part }) => part.unhide()
}
```

View file

@ -1,22 +0,0 @@
---
title: units()
---
Calling `units()` in a part's draft method will format a float you pass it --
which should represent a value in mm -- into the units requested by the user.
The returned value is to be used in presentation only, as it will be
a string that includes the user's units.
## units() example
```js
cont part = {
name: 'examples.units',
draft: ({ log, measurements, part }) => {
log.info(`Pattern drafted for a ${units(measurements.chest)} chest`)
return part
}
}
```

View file

@ -1,13 +1,19 @@
---
title: getId()
title: Part.getId()
---
Calling `getId()` in a part's draft method will return an integer the can be used as an
The `Part.getId()` methid will return an integer the can be used as an
for ID Points/Paths/Snippets. This method will ensure the ID is unique by
keeping an internal incremental counter of the IDs that have been used.
It is typically used when programatically adding points, paths, or snippets.
## getId() signature
<Tip>
This method can be destructured as `getID`
in [a part's draft method](/reference/api/part/draft).
</Tip>
## Part.getId() signature
```js
int|string getId(prefix='')
@ -15,7 +21,7 @@ int|string getId(prefix='')
This methiod takes an optional parameter that will be used as a prefix for the ID.
## getId() example
## Part.getId() example
```js
cont part = {

View file

@ -0,0 +1,28 @@
---
title: Part.hide()
---
The `Part.hide()` method will mark the part as hidden.
This method returns the `part` object, so it's chainable.
<Tip>
This method can be destructured as `hidden`
in [a part's draft method](/reference/api/part/draft).
</Tip>
<Related>
The [unhide](/reference/api/part/unhide) and
[setHidden](/reference/api/part/sethidden) methods also control a
part's visibility
</Related>
## Part.hide() example
```js
cont part = {
name: 'examples.hide',
draft: ({ hide, part }) => part.hide()
}
```

View file

@ -0,0 +1,32 @@
---
title: Part.setHidden()
---
The `Part.setHidden()` method will mark the part either hidden
or not, depending on the value you pass it.
This method returns the `part` object, so it's chainable
- Pass a *truthy* value: The part will be hidden
- Pass a *falsy* value: The part will be unhidden/revealed
<Tip>
This method can be destructured as `setHidden`
in [a part's draft method](/reference/api/part/draft).
</Tip>
<Related>
The [hide](/reference/api/part/hide) and
[unhide](/reference/api/part/unhide) also control a
part's visibility
</Related>
## Part.setHidden() example
```js
cont part = {
name: 'examples.hide',
draft: ({ setHidden, part }) => part.setHidden(true)
}
```

View file

@ -0,0 +1,28 @@
---
title: Part.unhide()
---
The `Part.unhide()` method will mark the part as not hidden.
This method returns the `part` object, so it's chainable.
<Tip>
This method can be destructured as `inhide`
in [a part's draft method](/reference/api/part/draft).
</Tip>
<Related>
The [hide](/reference/api/part/hide) and
[setHidden](/reference/api/part/sethidden) methods also control a
part's visibility
</Related>
## Part.unhide() example
```js
cont part = {
name: 'examples.hide',
draft: ({ unhide, part }) => part.unhide()
}
```