1
0
Fork 0

fix(hugo): Add neck binding part

This commit is contained in:
Benjamin Fan 2024-01-27 22:28:18 -08:00
parent 777a9db557
commit 2353362851
3 changed files with 114 additions and 7 deletions

View file

@ -7,24 +7,21 @@
"front": "Front",
"hoodCenter": "Hood center",
"hoodSide": "Hood side",
"neckBinding": "Neck binding",
"pocket": "Pocket",
"pocketFacing": "Pocket facing",
"sleeve": "Sleeve",
"waistband": "Waistband"
},
"s": {
"cuff": "Cuff",
"hoodCenter": "Hood center",
"hoodSide": "Hood side",
"pocketFacing": "Pocket facing",
"pocket": "Pocket",
"waistband": "Waistband",
"cutPocket.t": "The pocket is not shown",
"cutPocket.d": "The **Pocket** (4) is not shown, but you can trace it from the Front part (1), which has the pocket outline on it (not including seam allowance).",
"cutCuff.t": "The cuff is not shown",
"cutCuff.d": "The **Cuff** (9) is a rectangular piece of ribbing fabric {{{ w }}} wide and {{{ l }}} long.",
"cutHoodCenter.t": "The hood center is not shown",
"cutHoodCenter.d": "The **Hood center** (7) is a rectangular piece of ribbing fabric {{{ w }}} wide and {{{ l }}} long.",
"cutNeckBinding.t": "The neck binding is not shown",
"cutNeckBinding.d": "The **Neck Binding** (10) is a rectangular piece of ribbing fabric {{{ w }}} wide and {{{ l }}} long.",
"cutWaistband.t": "The waistband is not shown",
"cutWaistband.d": "The **Waistband** (8) is a rectangular piece of ribbing fabric {{{ w }}} wide and {{{ l }}} long"
},

View file

@ -11,11 +11,23 @@ import { hoodSide } from './hoodside.mjs'
import { hoodCenter } from './hoodcenter.mjs'
import { waistband } from './waistband.mjs'
import { cuff } from './cuff.mjs'
import { neckBinding } from './neckbinding.mjs'
// Setup our new design
const Hugo = new Design({
data,
parts: [back, front, sleeve, pocket, pocketFacing, hoodSide, hoodCenter, waistband, cuff],
parts: [
back,
front,
sleeve,
pocket,
pocketFacing,
hoodSide,
hoodCenter,
waistband,
cuff,
neckBinding,
],
})
// Merge translations
@ -32,6 +44,7 @@ export {
hoodCenter,
waistband,
cuff,
neckBinding,
Hugo,
i18n,
}

View file

@ -0,0 +1,97 @@
import { front } from './front.mjs'
import { back } from './back.mjs'
import { hoodCenter } from './hoodcenter.mjs'
function hugoNeckBinding({ store, sa, Point, points, Path, paths, macro, part, expand, units }) {
const length =
store.get('neckOpeningLenFront') * 2 +
store.get('neckOpeningLenBack') * 2 +
store.get('hoodCenterWidth')
const width = length / 44.2
if (expand) {
store.flag.preset('expandIsOn')
} else {
const extraSa = sa ? 2 * sa : 0
store.flag.note({
msg: `hugo:cutNeckBinding`,
notes: [sa ? 'flag:saIncluded' : 'flag:saExcluded', 'flag:partHiddenByExpand'],
replace: {
w: units(width + extraSa),
l: units(length + extraSa),
},
suggest: {
text: 'flag:show',
icon: 'expand',
update: {
settings: ['expand', 1],
},
},
})
// Also hint about expand
store.flag.preset('expandIsOff')
return part.hide()
}
points.topLeft = new Point(0, 0)
points.topRight = new Point(length, 0)
points.bottomRight = new Point(length, width)
points.bottomLeft = new Point(0, width)
paths.seam = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.close()
.attr('class', 'fabric')
// Seam allowance
if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
// Cutlist
store.cutlist.setCut({ cut: 1, from: 'fabric' })
// Grainline
macro('grainline', {
from: points.topLeft
.shiftFractionTowards(points.topRight, 0.15)
.shiftFractionTowards(points.bottomLeft, 0.6),
to: points.topRight
.shiftFractionTowards(points.topLeft, 0.15)
.shiftFractionTowards(points.bottomRight, 0.6),
})
//title
points.title = new Point(length / 2, width * 3)
macro('title', {
at: points.title,
nr: 10,
title: 'neckBinding',
scale: 0.4,
})
// Dimensions
macro('hd', {
id: 'length',
from: points.bottomLeft,
to: points.bottomRight,
y: points.bottomLeft.y + sa + 15,
})
macro('vd', {
id: 'width',
from: points.topRight,
to: points.bottomRight,
x: points.topRight.x + sa + 15,
})
return part
}
export const neckBinding = {
name: 'hugo.neckBinding',
after: [front, back, hoodCenter],
draft: hugoNeckBinding,
}