1
0
Fork 0
This commit is contained in:
woutervdub 2023-10-31 18:41:09 +00:00
parent 119fe603f1
commit 16baa11dc6
4 changed files with 43 additions and 33 deletions

View file

@ -50,7 +50,7 @@ export function draftCurvedWaistband({
if (points[uid + 'Rotated']) points[shortId + 'Rotated'] = points[uid + 'Rotated'].copy() if (points[uid + 'Rotated']) points[shortId + 'Rotated'] = points[uid + 'Rotated'].copy()
} }
if (sa) paths.sa = paths.seam.offset(sa * -1).addClass('fabric sa') if (sa) paths.sa = paths.seam.offset(sa).addClass('fabric sa')
/* /*
* Annotations * Annotations

View file

@ -111,40 +111,41 @@ function sandySkirt({
if (sa) { if (sa) {
paths.hemBase = new Path() paths.hemBase = new Path()
.move(points.ex2) .move(points.ex2Flipped)
.curve(points.ex2c, points.ex1c, points.ex1) .curve(points.ex2cFlipped, points.ex1cFlipped, points.ex1)
.curve(points.ex1cFlipped, points.ex2cFlipped, points.ex2Flipped) .curve(points.ex1c, points.ex2c, points.ex2)
.offset(store.get('fullLength') * options.lengthBonus * options.hemWidth * -1) .offset(store.get('fullLength') * options.lengthBonus * options.hemWidth)
paths.saBase = new Path() paths.saBase = new Path()
.move(points.in2Flipped) .move(points.in2)
.curve(points.in2cFlipped, points.in1cFlipped, points.in1) .curve(points.in2c, points.in1c, points.in1)
.curve(points.in1c, points.in2c, points.in2) .curve(points.in1cFlipped, points.in2cFlipped, points.in2Flipped)
if (!options.seamlessFullCircle) paths.saBase = paths.saBase.line(points.ex2) if (!options.seamlessFullCircle)
paths.saBase = paths.saBase.offset(sa * -1) paths.saBase = new Path().move(points.ex2).line(points.ex2).join(paths.saBase)
paths.saBase = paths.saBase.offset(sa)
paths.hemBase.hide() paths.hemBase.hide()
paths.saBase.hide() paths.saBase.hide()
if (options.seamlessFullCircle) { if (options.seamlessFullCircle) {
paths.sa = new Path() paths.sa = new Path()
.move(points.in2Flipped) .move(points.ex2Flipped)
.line(paths.saBase.start())
.join(paths.saBase)
.line(points.in2)
.move(points.ex2)
.line(paths.hemBase.start()) .line(paths.hemBase.start())
.join(paths.hemBase) .join(paths.hemBase)
.line(points.ex2Flipped) .line(points.ex2)
.move(points.in2)
.line(paths.saBase.start())
.join(paths.saBase)
.line(points.in2Flipped)
.attr('class', 'fabric sa') .attr('class', 'fabric sa')
} else { } else {
paths.sa = new Path() paths.sa = new Path()
.move(points.in2Flipped) .move(points.ex2Flipped)
.line(paths.saBase.start())
.join(paths.saBase)
.line(paths.hemBase.start()) .line(paths.hemBase.start())
.join(paths.hemBase) .join(paths.hemBase)
.line(points.ex2Flipped) .line(paths.saBase.start())
.join(paths.saBase)
.line(points.in2Flipped)
.attr('class', 'fabric sa') .attr('class', 'fabric sa')
} }
} }
@ -171,15 +172,24 @@ function sandySkirt({
} }
// Logo // Logo
points.logo = points.in2FlippedRotated.shiftFractionTowards(points.ex2FlippedRotated, 0.3) points.logo = points.in2FlippedRotated.shiftFractionTowards(
points.ex2FlippedRotated,
options.seamlessFullCircle ? 0.3 : 0.1
)
snippets.logo = new Snippet('logo', points.logo) snippets.logo = new Snippet('logo', points.logo)
// Title // Title
points.title = points.in2FlippedRotated.shiftFractionTowards(points.ex2FlippedRotated, 0.5) points.title = points.in2FlippedRotated.shiftFractionTowards(
points.ex2FlippedRotated,
options.seamlessFullCircle ? 0.5 : 0.25
)
macro('title', { at: points.title, nr: 1, title: 'skirt' }) macro('title', { at: points.title, nr: 1, title: 'skirt' })
// Scalebox // Scalebox
points.scalebox = points.in2FlippedRotated.shiftFractionTowards(points.ex2FlippedRotated, 0.7) points.scalebox = points.in2FlippedRotated.shiftFractionTowards(
points.ex2FlippedRotated,
options.seamlessFullCircle ? 0.7 : 0.45
)
macro('scalebox', { at: points.scalebox }) macro('scalebox', { at: points.scalebox })
// Notches // Notches

View file

@ -26,7 +26,6 @@ macro('ringsector', {
Number insideRadius, Number insideRadius,
Number outsideRadius, Number outsideRadius,
Boolean rotate = false, Boolean rotate = false,
String id='ringsector',
}) })
``` ```
@ -51,18 +50,19 @@ macro('ringsector', {
| Property | Default | Type | Description | | Property | Default | Type | Description |
|---------------:|-------------------|------------|-------------| |---------------:|-------------------|------------|-------------|
| `id` | `ringsector` | `string` | The ID of this macro instance | | `id` | `ringsector` | String | The id to use in auto-generate macro points and paths |
| `center` | `new Point(0,0)` | [Point][1] | The center point of the ring sector | | `center` | `new Point(0,0)` | [Point][1] | The center point of the ring sector |
| `angle` | | Number | The angle the ring sector should cover | | `angle` | | Number | The angle the ring sector should cover |
| `insideRadius` | | Number | The inside radius of the ring sector | | `insideRadius` | | Number | The inside radius of the ring sector |
| `outsideRadius` | | Number | The outside radius of the ring sector | | `outsideRadius` | | Number | The outside radius of the ring sector |
| `rotate` | `false` | Boolean | Whether or not to rotate the ringsector so one of its sides is vertical (see [example below](#example-when-rotatetrue)) | | `rotate` | `false` | Boolean | Whether or not to rotate the ringsector so one of its sides is vertical (see [example below](#example-when-rotatetrue)) |
| `id` | `ringsector` | String | The id to use in auto-generate macro points and paths |
[1]: /reference/api/point [1]: /reference/api/point
## Notes ## Notes
The `ringsector` macro creates a `path` that can be used as a seam path for a part. If doing so, the left side of the path assumes a `cutOnFold`, as the `sa` is not offset here like it is along the rest of the `path`.
### Example when rotate=true ### Example when rotate=true
<Example caption="Example of a ring sector drafted by this macro when rotate is truthy"> <Example caption="Example of a ring sector drafted by this macro when rotate is truthy">

View file

@ -126,7 +126,7 @@ export const plugin = {
// Flip all the points to generate the full ring sector // Flip all the points to generate the full ring sector
for (const id of ['in2', 'in2c', 'in1c', 'ex1c', 'ex2c', 'ex2']) { for (const id of ['in2', 'in2c', 'in1c', 'ex1c', 'ex2c', 'ex2']) {
points[ids[id + 'Flipped']] = points[ids[id]].flipX() points[ids[id + 'Flipped']] = points[ids[id]].flipX(center)
} }
// Rotate all the points angle/2 // Rotate all the points angle/2
@ -147,12 +147,12 @@ export const plugin = {
} }
// Construct the path of the full ring sector // Construct the path of the full ring sector
paths[pathIds.path] = new Path() paths[pathIds.path] = new Path()
.move(points[ids.in2Flipped]) .move(points[ids.ex2Flipped])
.curve(points[ids.in2cFlipped], points[ids.in1cFlipped], points[ids.in1]) .curve(points[ids.ex2cFlipped], points[ids.ex1cFlipped], points[ids.ex1])
.curve(points[ids.in1c], points[ids.in2c], points[ids.in2]) .curve(points[ids.ex1c], points[ids.ex2c], points[ids.ex2])
.line(points[ids.ex2]) .line(points[ids.in2])
.curve(points[ids.ex2c], points[ids.ex1c], points[ids.ex1]) .curve(points[ids.in2c], points[ids.in1c], points[ids.in1])
.curve(points[ids.ex1cFlipped], points[ids.ex2cFlipped], points[ids.ex2Flipped]) .curve(points[ids.in1cFlipped], points[ids.in2cFlipped], points[ids.in2Flipped])
.close() .close()
/* /*