1
0
Fork 0
freesewing/designs/simon/src/yoke.mjs

142 lines
3.5 KiB
JavaScript
Raw Normal View History

2022-09-04 15:55:34 +02:00
import { back } from './back.mjs'
import { splitYoke } from './options.mjs'
function simonYoke({
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
macro,
options,
store,
part,
}) {
for (const id in paths) {
if (['backCollar', 'backArmhole', 'backArmholeYoke'].indexOf(id) === -1) delete part.paths[id]
}
2018-12-23 14:54:34 +01:00
store.cutlist.setCut({ cut: 2, from: 'fabric' })
2018-12-23 14:54:34 +01:00
// Paths
paths.saBase = new Path().move(points.cbYoke).line(points.armholeYokeSplitPreBoxpleat)
if (options.yokeHeight > 0) paths.saBase = paths.saBase.join(paths.backArmholeYoke)
2021-08-30 11:40:16 +02:00
paths.saBase = paths.saBase.line(points.s3CollarSplit).join(paths.backCollar)
2019-08-03 15:03:33 +02:00
if (options.splitYoke) paths.saBase = paths.saBase.line(points.cbYoke).close()
else {
macro('mirror', {
2021-08-30 11:40:16 +02:00
mirror: [points.cbNeck, points.cbYoke],
2023-04-15 16:21:38 +02:00
paths: ['saBase'],
2021-08-30 11:40:16 +02:00
clone: true,
})
paths.saBase = paths.saBase.join(paths.mirroredSaBase.reverse())
2022-09-18 17:01:19 +02:00
paths.mirroredSaBase.hide()
}
2019-08-03 15:03:33 +02:00
paths.seam = paths.saBase.clone()
2022-09-18 17:01:19 +02:00
paths.saBase.hide()
2019-08-03 15:03:33 +02:00
paths.seam = paths.seam.close().attr('class', 'fabric')
2023-09-18 18:40:19 +02:00
if (sa) {
paths.sa = paths.saBase.offset(sa).attr('class', 'fabric sa')
if (options.splitYoke) {
paths.sa = paths.sa.line(points.cbNeck).move(points.cbYoke).line(paths.sa.start())
}
}
2018-12-23 14:54:34 +01:00
2023-09-18 18:40:19 +02:00
/*
* Annotations
*/
// Notches
delete snippets.armholePitchNotch
delete snippets.collarNotch
delete snippets.shoulderNotch
snippets.sleevecapNotch = new Snippet('notch', points.armholeYokeSplitPreBoxpleat)
2018-12-23 14:54:34 +01:00
2023-09-18 18:40:19 +02:00
// Title
points.title = new Point(points.neck.x, points.cbYoke.y / 2)
macro('title', { at: points.title, nr: 4, title: 'yoke', scale: 0.8 })
2022-07-18 15:15:52 -04:00
2023-09-18 18:40:19 +02:00
// Logo
points.logo = new Point(points.neck.x / 2, points.cbYoke.y * 0.5)
snippets.logo = new Snippet('logo', points.logo).scale(0.666)
2018-12-23 14:54:34 +01:00
2023-09-18 18:40:19 +02:00
// Grainline
points.grainlineFrom = points.cbYoke.shiftFractionTowards(points.cbNeck, 0.2)
points.grainlineTo = points.cbNeck.shiftFractionTowards(points.cbYoke, 0.2)
macro('grainline', {
from: points.grainlineFrom,
to: points.grainlineTo,
})
// Dimensions
macro('hd', {
id: 'wCbToHps',
from: points.cbNeck,
to: points.s3CollarSplit,
y: points.s3CollarSplit.y - 15 - sa,
})
macro('ld', {
id: 'lShoulderSeam',
from: points.s3CollarSplit,
to: points.s3ArmholeSplit,
d: 15 + sa,
})
if (options.splitYoke) {
2019-08-03 15:03:33 +02:00
macro('hd', {
2023-09-18 18:40:19 +02:00
id: 'wCbToYokeEdge',
2018-12-27 15:04:32 +01:00
from: points.cbYoke,
2023-09-18 18:40:19 +02:00
to: points.armholeYokeSplitPreBoxpleat,
2021-04-24 10:16:31 +02:00
y: points.cbYoke.y + 15 + sa,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2023-09-18 18:40:19 +02:00
id: 'wFullHalf',
2018-12-27 15:04:32 +01:00
from: points.cbYoke,
2021-06-19 12:50:46 +02:00
to: points.s3ArmholeSplit,
2021-04-24 10:16:31 +02:00
y: points.cbYoke.y + 30 + sa,
2019-08-03 15:03:33 +02:00
})
2023-09-18 18:40:19 +02:00
} else {
macro('hd', {
id: 'wAtYoke',
from: points.armholeYokeSplitPreBoxpleat.flipX(),
to: points.armholeYokeSplitPreBoxpleat,
y: points.cbYoke.y + 15 + sa,
2019-08-03 15:03:33 +02:00
})
2023-09-18 18:40:19 +02:00
macro('hd', {
id: 'wFullHalf',
from: points.s3ArmholeSplit.flipX(),
2021-06-19 12:50:46 +02:00
to: points.s3ArmholeSplit,
2023-09-18 18:40:19 +02:00
y: points.cbYoke.y + 30 + sa,
2019-08-03 15:03:33 +02:00
})
2018-12-23 14:54:34 +01:00
}
2023-09-18 18:40:19 +02:00
macro('vd', {
id: 'hAtCb',
from: points.cbYoke,
to: points.cbNeck,
x: points.cbYoke.x - 15 - sa,
})
macro('vd', {
id: 'wToShoulder',
from: points.cbYoke,
to: points.s3ArmholeSplit,
x: points.s3ArmholeSplit.x + 15 + sa,
})
macro('vd', {
id: 'wToHps',
from: points.cbYoke,
to: points.s3CollarSplit,
x: points.s3ArmholeSplit.x + 30 + sa,
})
2018-12-23 14:54:34 +01:00
2019-08-03 15:03:33 +02:00
return part
}
2022-09-04 15:55:34 +02:00
export const yoke = {
name: 'simon.yoke',
from: back,
options: {
splitYoke,
},
draft: simonYoke,
}