1
0
Fork 0
freesewing/packages/hugo/src/front.js

180 lines
4.9 KiB
JavaScript
Raw Normal View History

2018-12-20 11:41:35 +01:00
export default function(part) {
// Remove clutter
2019-08-03 15:03:33 +02:00
let seam = part.paths.seam
part.paths = {}
part.paths.seam = seam
2018-09-21 21:30:20 +02:00
let {
utils,
store,
sa,
Point,
points,
Path,
paths,
Snippet,
snippets,
options,
measurements,
complete,
paperless,
macro,
debug
2019-08-03 15:03:33 +02:00
} = part.shorthand()
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
// Absolute values for percentages
store.set(
2019-08-03 15:03:33 +02:00
'lengthBonus',
options.lengthBonus * (measurements.centerBackNeckToWaist + measurements.naturalWaistToHip)
)
2018-12-20 11:41:35 +01:00
store.set(
2019-08-03 15:03:33 +02:00
'ribbing',
(measurements.centerBackNeckToWaist + measurements.naturalWaistToHip) * options.ribbingHeight
)
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
// Hem is more descripting than hips in this case
//points.cfHem = points.cfHips;
//points.hem = points.hips;
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
// Ribbing
2019-08-03 15:03:33 +02:00
points.cfRibbing = points.cfHem.shift(90, store.get('ribbing'))
points.ribbing = points.hem.shift(90, store.get('ribbing'))
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
// Raglan tip
2019-08-03 15:03:33 +02:00
let neckOpening = new Path().move(points.cfNeck).curve(points.cfNeck, points.neckCp2, points.neck)
points.raglanTipFront = neckOpening.shiftFractionAlong(0.8)
let neckOpeningParts = neckOpening.split(points.raglanTipFront)
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
// Pocket
2019-08-03 15:03:33 +02:00
points.pocketHem = points.cfRibbing.shiftFractionTowards(points.ribbing, 0.6)
points.pocketCf = points.cfHem.shift(
90,
2019-08-03 15:03:33 +02:00
measurements.centerBackNeckToWaist * 0.33 + store.get('ribbing')
)
points.pocketTop = new Point(points.pocketHem.x, points.pocketCf.y)
2018-12-20 11:41:35 +01:00
points.pocketTip = points.pocketHem
.shift(90, points.pocketHem.x / 3)
2019-08-03 15:03:33 +02:00
.rotate(-30, points.pocketHem)
points.pocketTopCp = utils.beamsIntersect(
points.pocketTop,
points.pocketHem,
points.pocketTip,
points.pocketHem.rotate(90, points.pocketTip)
2019-08-03 15:03:33 +02:00
)
2018-12-20 11:41:35 +01:00
// Paths
paths.saBase = new Path()
.move(points.cfRibbing)
.line(points.ribbing)
.line(points.armhole)
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
.line(points.raglanTipFront)
2019-08-03 15:03:33 +02:00
.join(neckOpeningParts[0].reverse())
2018-12-20 11:41:35 +01:00
paths.seam = paths.saBase
.clone()
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric')
paths.saBase.render = false
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
paths.pocket = new Path()
.move(points.pocketHem)
.line(points.pocketTip)
.curve(points.pocketTip, points.pocketTopCp, points.pocketTop)
.line(points.pocketCf)
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric help')
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
// Store shoulder seam length, neck opening path, shoulder slope and raglan length
2019-08-03 15:03:33 +02:00
store.set('shoulderLength', points.neck.dist(points.shoulder))
store.set('neckOpeningPartFront', neckOpeningParts[1])
store.set('neckOpeningAnchorFront', points.neck)
store.set('shoulderSlopeDeltaY', points.neck.dy(points.shoulder))
2018-12-20 11:41:35 +01:00
store.set(
2019-08-03 15:03:33 +02:00
'raglen',
2018-12-20 11:41:35 +01:00
new Path()
.move(points.raglanTipFront)
.line(points.armholeHollow)
.curve(points.armholeHollowCp1, points.armholeCp2, points.armhole)
.length()
2019-08-03 15:03:33 +02:00
)
store.set('neckOpeningLenFront', neckOpening.length())
store.set('neckCutoutFront', points.cfNeck.y)
2018-09-21 21:30:20 +02:00
2018-12-20 11:41:35 +01:00
// Complete pattern?
if (complete) {
2019-08-03 15:03:33 +02:00
macro('cutonfold', {
2018-12-20 11:41:35 +01:00
from: points.cfNeck,
to: points.cfRibbing,
grainline: true
2019-08-03 15:03:33 +02:00
})
points.title = new Point(points.armhole.x / 2, points.armhole.y)
macro('title', { at: points.title, nr: 1, title: 'front' })
store.set('notchFront', points.raglanTipFront.dist(points.armholeHollow) / 2)
2018-12-20 11:41:35 +01:00
points.sleeveNotch = points.raglanTipFront.shiftTowards(
points.armholeHollow,
2019-08-03 15:03:33 +02:00
store.get('notchFront')
)
snippets.sleeveNotch = new Snippet('notch', points.sleeveNotch)
store.set('frontRaglanTipToNotch', points.raglanTipFront.dist(points.sleeveNotch))
points.logo = points.title.shift(-90, 70)
snippets.logo = new Snippet('logo', points.logo)
2018-12-20 11:41:35 +01:00
if (sa) {
paths.sa = paths.saBase
.offset(sa)
.line(points.cfNeck)
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric sa')
paths.sa.move(points.cfRibbing).line(paths.sa.start())
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('vd', {
2018-12-20 11:41:35 +01:00
from: points.cfRibbing,
to: points.cfNeck,
x: points.cfNeck.x - 15
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2018-12-20 11:41:35 +01:00
from: points.cfRibbing,
to: points.raglanTipFront,
x: points.cfNeck.x - 30
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2018-12-20 11:41:35 +01:00
from: points.ribbing,
to: points.armhole,
x: points.ribbing.x + 15 + sa
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2018-12-20 11:41:35 +01:00
from: points.cfNeck,
to: points.raglanTipFront,
y: points.raglanTipFront.y - 15 - sa
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2018-12-20 11:41:35 +01:00
from: points.raglanTipFront,
to: points.armhole,
y: points.raglanTipFront.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.pocketTop,
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,
y: points.cfRibbing.y + 30 + sa
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2018-12-20 11:41:35 +01:00
from: points.cfRibbing,
to: points.ribbing,
y: points.cfRibbing.y + 45 + 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,
x: points.pocketTip.x + 15
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
}