1
0
Fork 0
freesewing/designs/hugo/src/pocket.mjs

95 lines
2.3 KiB
JavaScript
Raw Normal View History

2022-09-05 19:21:51 +02:00
import { front } from './front.mjs'
2022-09-11 15:41:29 +02:00
function hugoPocket({ utils, store, sa, points, Path, paths, complete, paperless, macro, part }) {
return part
2018-12-20 11:41:35 +01:00
// Remove clutter
const pocket = part.paths.pocket
2019-08-03 15:03:33 +02:00
part.paths = {}
part.snippets = {}
2018-09-21 21:30:20 +02:00
paths.seam = pocket
.line(points.cfRibbing)
.line(points.pocketHem)
.close()
.attr('class', 'fabric', true)
paths.seam.render = true
2018-09-21 21:30:20 +02:00
2022-05-31 15:58:50 +02:00
paths.saBase = new Path()
.move(points.cfRibbing)
.line(points.pocketHem)
.line(points.pocketTip)
._curve(points.pocketTopCp, points.pocketTop)
.line(points.pocketCf)
.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')
paths.facing.render = false
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
// Complete pattern?
if (complete) {
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
}
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,
}