2022-09-05 19:21:51 +02:00
|
|
|
import { front } from './front.mjs'
|
|
|
|
|
2022-09-15 13:49:55 +02:00
|
|
|
function hugoPocket({
|
|
|
|
utils,
|
|
|
|
store,
|
|
|
|
sa,
|
|
|
|
points,
|
|
|
|
Path,
|
|
|
|
paths,
|
|
|
|
complete,
|
|
|
|
paperless,
|
|
|
|
macro,
|
|
|
|
snippets,
|
|
|
|
part,
|
|
|
|
}) {
|
2018-12-20 11:41:35 +01:00
|
|
|
// Remove clutter
|
2022-09-14 15:02:39 +02:00
|
|
|
for (const key in paths) {
|
|
|
|
if (key !== 'pocket') delete paths[key]
|
|
|
|
}
|
|
|
|
for (const key in snippets) delete snippets[key]
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2022-09-14 15:02:39 +02:00
|
|
|
paths.seam = paths.pocket
|
2022-01-27 10:06:06 +01:00
|
|
|
.line(points.cfRibbing)
|
|
|
|
.line(points.pocketHem)
|
|
|
|
.close()
|
|
|
|
.attr('class', 'fabric', true)
|
2020-04-18 17:52:32 +02:00
|
|
|
paths.seam.render = true
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2022-05-31 15:58:50 +02:00
|
|
|
paths.saBase = new Path()
|
2022-01-27 10:06:06 +01:00
|
|
|
.move(points.cfRibbing)
|
|
|
|
.line(points.pocketHem)
|
2022-05-26 18:32:16 +02:00
|
|
|
.line(points.pocketTip)
|
|
|
|
._curve(points.pocketTopCp, points.pocketTop)
|
|
|
|
.line(points.pocketCf)
|
2022-01-27 10:06:06 +01:00
|
|
|
.setRender(false)
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
store.set('facingWidth', points.pocketHem.dist(points.pocketTip) / 2)
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
let facing = new Path()
|
|
|
|
.move(points.pocketTip)
|
|
|
|
.curve(points.pocketTip, points.pocketTopCp, points.pocketTop)
|
2019-08-03 15:03:33 +02:00
|
|
|
.offset(store.get('facingWidth') * -1)
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
points._tmp = facing.shiftAlong(2)
|
2018-12-20 11:41:35 +01:00
|
|
|
points.facingEnd = utils.beamsIntersect(
|
|
|
|
points._tmp,
|
|
|
|
facing.start(),
|
|
|
|
points.pocketHem,
|
|
|
|
points.pocketTip
|
2019-08-03 15:03:33 +02:00
|
|
|
)
|
2018-12-20 11:41:35 +01:00
|
|
|
paths.facing = new Path()
|
|
|
|
.move(points.facingEnd)
|
|
|
|
.line(facing.start())
|
|
|
|
.join(facing)
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', ' fabric help')
|
2020-04-18 17:52:32 +02:00
|
|
|
paths.facing.render = false
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
// Complete pattern?
|
|
|
|
if (complete) {
|
2020-04-18 17:52:32 +02:00
|
|
|
paths.facing.render = true
|
2021-03-02 12:33:31 -08:00
|
|
|
macro('cutonfold', {
|
|
|
|
from: points.pocketCf,
|
|
|
|
to: points.cfRibbing,
|
2021-04-24 10:16:31 +02:00
|
|
|
grainline: true,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
points.title = points.cfRibbing.shiftFractionTowards(points.pocketTop, 0.5)
|
|
|
|
macro('title', { at: points.title, nr: 4, title: 'pocket' })
|
2018-12-20 11:41:35 +01:00
|
|
|
if (sa) {
|
2022-03-28 19:38:18 +02:00
|
|
|
paths.sa = paths.saBase.offset(sa).line(points.pocketCf).move(points.cfRibbing)
|
|
|
|
paths.sa.line(paths.sa.start()).attr('class', 'fabric sa')
|
2018-09-21 21:30:20 +02:00
|
|
|
}
|
2018-12-20 11:41:35 +01:00
|
|
|
}
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
// Paperless?
|
|
|
|
if (paperless) {
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('hd', {
|
2018-12-20 11:41:35 +01:00
|
|
|
from: points.cfRibbing,
|
|
|
|
to: points.pocketTop,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.cfRibbing.y + 15 + sa,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2018-12-20 11:41:35 +01:00
|
|
|
from: points.cfRibbing,
|
|
|
|
to: points.pocketTip,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.cfRibbing.y + 30 + sa,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
2018-12-20 11:41:35 +01:00
|
|
|
from: points.pocketHem,
|
|
|
|
to: points.pocketTip,
|
2021-04-24 10:16:31 +02:00
|
|
|
x: points.pocketTip.x + 15 + sa,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
2018-12-20 11:41:35 +01:00
|
|
|
from: points.pocketHem,
|
|
|
|
to: points.pocketTop,
|
2021-04-24 10:16:31 +02:00
|
|
|
x: points.cfRibbing.x - 15 - sa,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2018-09-21 21:30:20 +02:00
|
|
|
}
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return part
|
2019-05-10 13:14:31 +02:00
|
|
|
}
|
2022-09-05 19:21:51 +02:00
|
|
|
|
|
|
|
export const pocket = {
|
|
|
|
name: 'hugo.pocket',
|
|
|
|
from: front,
|
2022-09-11 18:09:32 +02:00
|
|
|
hideDependencies: true,
|
2022-09-05 19:21:51 +02:00
|
|
|
draft: hugoPocket,
|
|
|
|
}
|