2020-04-18 17:52:54 +02:00
|
|
|
export default function (part) {
|
2018-12-20 11:41:35 +01:00
|
|
|
// 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
|
|
|
|
2019-05-10 13:14:31 +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
|
2020-02-01 16:10:00 +01:00
|
|
|
store.set('lengthBonus', options.lengthBonus * measurements.hpsToHipsBack)
|
|
|
|
store.set('ribbing', measurements.hpsToHipsBack * 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
|
2018-12-21 15:32:01 +01:00
|
|
|
//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)
|
2019-05-02 12:40:03 +02:00
|
|
|
points.pocketCf = points.cfHem.shift(
|
|
|
|
90,
|
2020-02-01 16:10:00 +01:00
|
|
|
(measurements.hpsToHipsBack - measurements.naturalWaistToHip) * 0.33 + store.get('ribbing')
|
2019-08-03 15:03:33 +02:00
|
|
|
)
|
|
|
|
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)
|
2018-12-21 15:32:01 +01:00
|
|
|
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())
|
2020-04-18 17:52:54 +02:00
|
|
|
paths.seam = paths.saBase.clone().close().attr('class', 'fabric')
|
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')
|
2020-04-18 17:52:54 +02:00
|
|
|
paths.saBase.render = false
|
|
|
|
paths.pocket.render = false
|
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) {
|
2020-04-18 17:52:54 +02:00
|
|
|
paths.pocket.render = true
|
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) {
|
2020-04-18 17:52:54 +02:00
|
|
|
paths.sa = paths.saBase.offset(sa).line(points.cfNeck).attr('class', 'fabric sa')
|
2019-08-03 15:03:33 +02:00
|
|
|
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
|
2019-05-02 12:40:03 +02:00
|
|
|
}
|