2021-01-30 16:30:45 +01:00
|
|
|
export default (part) => {
|
2021-03-10 20:27:50 +01:00
|
|
|
// Helper method to draw the outseam path
|
2021-03-13 09:58:17 +01:00
|
|
|
const drawOutseam = () =>
|
|
|
|
new Path()
|
2021-03-14 18:02:22 +01:00
|
|
|
.move(points.slantTop)
|
|
|
|
.line(points.slantCurveStart)
|
|
|
|
.curve(points.slantCurveCp1, points.slantCurveCp2, points.slantCurveEnd)
|
|
|
|
.join(sideSeam.split(points.slantCurveEnd).pop())
|
2021-03-10 20:27:50 +01:00
|
|
|
|
|
|
|
// Helper method to draw the outline path
|
2021-03-13 09:58:17 +01:00
|
|
|
const drawPath = () => {
|
|
|
|
let outseam = drawOutseam()
|
|
|
|
return new Path()
|
|
|
|
.move(points.floorIn)
|
2021-03-10 20:27:50 +01:00
|
|
|
.curve(points.kneeInCp2, points.forkCp1, points.fork)
|
2021-03-14 18:02:22 +01:00
|
|
|
.curve(points.crotchSeamCurveCp1, points.crotchSeamCurveCp2, points.crotchSeamCurveStart)
|
2021-03-10 20:27:50 +01:00
|
|
|
.line(points.styleWaistIn)
|
2021-03-14 18:02:22 +01:00
|
|
|
.line(points.slantTop)
|
2021-03-13 09:58:17 +01:00
|
|
|
.join(outseam)
|
|
|
|
}
|
2021-03-10 20:27:50 +01:00
|
|
|
|
2021-01-30 16:30:45 +01:00
|
|
|
// Shorthand
|
|
|
|
let {
|
|
|
|
points,
|
|
|
|
Point,
|
|
|
|
paths,
|
|
|
|
Path,
|
|
|
|
measurements,
|
|
|
|
options,
|
|
|
|
complete,
|
|
|
|
paperless,
|
|
|
|
store,
|
|
|
|
macro,
|
|
|
|
utils,
|
|
|
|
snippets,
|
|
|
|
Snippet,
|
|
|
|
sa
|
|
|
|
} = part.shorthand()
|
|
|
|
|
2021-03-14 18:02:22 +01:00
|
|
|
// Helper object holding the Titan side seam path
|
|
|
|
const sideSeam =
|
|
|
|
points.waistOut.x < points.seatOut.x
|
|
|
|
? new Path()
|
|
|
|
.move(points.styleWaistOut)
|
|
|
|
.curve(points.seatOut, points.kneeOutCp1, points.floorOut)
|
|
|
|
: new Path()
|
|
|
|
.move(points.styleWaistOut)
|
|
|
|
._curve(points.seatOutCp1, points.seatOut)
|
|
|
|
.curve(points.seatOutCp2, points.kneeOutCp1, points.floorOut)
|
|
|
|
|
|
|
|
// Draw fly J-seam
|
2021-03-09 19:21:50 +01:00
|
|
|
points.flyBottom = utils.curveIntersectsY(
|
|
|
|
points.crotchSeamCurveStart,
|
|
|
|
points.crotchSeamCurveCp2,
|
|
|
|
points.crotchSeamCurveCp1,
|
|
|
|
points.fork,
|
|
|
|
points.cfSeat.shiftFractionTowards(points.crotchSeamCurveCp2, options.flyLength).y
|
|
|
|
)
|
2021-04-09 18:39:56 +02:00
|
|
|
points.flyExtensionBottom = utils.curveIntersectsY(
|
|
|
|
points.crotchSeamCurveStart,
|
|
|
|
points.crotchSeamCurveCp2,
|
|
|
|
points.crotchSeamCurveCp1,
|
|
|
|
points.fork,
|
|
|
|
points.cfSeat.shiftFractionTowards(points.crotchSeamCurveCp2, options.flyLength * 1.25).y
|
|
|
|
)
|
2021-03-09 19:21:50 +01:00
|
|
|
points.flyTop = points.styleWaistOut.shiftFractionTowards(
|
|
|
|
points.styleWaistIn,
|
2021-03-14 18:02:22 +01:00
|
|
|
1 - options.flyWidth
|
2021-03-09 19:21:50 +01:00
|
|
|
)
|
2021-04-11 17:15:58 +02:00
|
|
|
|
2021-03-09 19:21:50 +01:00
|
|
|
points.flyCorner = points.flyTop.shift(
|
2021-03-14 18:02:22 +01:00
|
|
|
points.styleWaistIn.angle(points.crotchSeamCurveStart),
|
2021-03-09 19:21:50 +01:00
|
|
|
points.styleWaistIn.dist(points.flyBottom)
|
|
|
|
)
|
2021-04-11 17:15:58 +02:00
|
|
|
points.flyCurveStart = points.flyCorner.shiftTowards(
|
|
|
|
points.flyTop,
|
|
|
|
points.flyBottom.dist(points.flyCorner)
|
|
|
|
)
|
2021-03-09 19:21:50 +01:00
|
|
|
points.flyCurveCp1 = points.flyBottom.shiftFractionTowards(points.flyCorner, options.flyCurve)
|
|
|
|
points.flyCurveCp2 = points.flyCurveStart.shiftFractionTowards(points.flyCorner, options.flyCurve)
|
|
|
|
|
2021-03-13 09:58:17 +01:00
|
|
|
// Construct pocket slant
|
2021-03-14 18:02:22 +01:00
|
|
|
points.slantTop = points.styleWaistIn.shiftFractionTowards(
|
2021-03-13 09:58:17 +01:00
|
|
|
points.styleWaistOut,
|
|
|
|
1 - options.frontPocketSlantWidth
|
|
|
|
)
|
2021-03-14 18:02:22 +01:00
|
|
|
points.slantLowest = sideSeam.intersectsY(points.fork.y).pop()
|
|
|
|
store.set('slantWidth', points.styleWaistOut.dist(points.slantTop))
|
2021-03-13 09:58:17 +01:00
|
|
|
store.set(
|
|
|
|
'slantLength',
|
2021-03-14 18:02:22 +01:00
|
|
|
sideSeam.split(points.slantLowest).shift().length() * options.frontPocketSlantDepth
|
2021-03-13 09:58:17 +01:00
|
|
|
)
|
2021-03-14 18:02:22 +01:00
|
|
|
points.slantBottom = sideSeam.shiftAlong(store.get('slantLength'))
|
|
|
|
points.slantCurveStart = points.slantBottom.shiftFractionTowards(
|
|
|
|
points.slantTop,
|
|
|
|
options.frontPocketSlantRound
|
2021-03-13 09:58:17 +01:00
|
|
|
)
|
2021-03-14 18:02:22 +01:00
|
|
|
points.slantCurveEnd = sideSeam.shiftAlong(
|
|
|
|
points.slantBottom.dist(points.slantCurveStart) + store.get('slantLength')
|
2021-03-13 09:58:17 +01:00
|
|
|
)
|
2021-03-14 18:02:22 +01:00
|
|
|
points.slantCurveCp1 = points.slantBottom.shiftFractionTowards(
|
|
|
|
points.slantCurveStart,
|
|
|
|
options.frontPocketSlantBend
|
2021-03-13 09:58:17 +01:00
|
|
|
)
|
2021-03-14 18:02:22 +01:00
|
|
|
points.slantCurveCp2 = sideSeam.shiftAlong(
|
|
|
|
points.slantBottom.dist(points.slantCurveCp1) + store.get('slantLength')
|
2021-03-13 09:58:17 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// Construct pocket bag
|
2021-03-14 18:02:22 +01:00
|
|
|
points.pocketbagTopRight = points.slantTop.shiftFractionTowards(
|
2021-03-13 09:58:17 +01:00
|
|
|
points.styleWaistIn,
|
|
|
|
options.frontPocketWidth
|
|
|
|
)
|
|
|
|
points.pocketbagBottomRight = points.pocketbagTopRight.shift(
|
2021-03-14 18:02:22 +01:00
|
|
|
points.slantTop.angle(points.pocketbagTopRight) - 90,
|
2021-03-13 09:58:17 +01:00
|
|
|
points.styleWaistIn.dy(points.fork) * options.frontPocketDepth * 1.5
|
|
|
|
)
|
2021-03-14 18:02:22 +01:00
|
|
|
points.pocketbagBottomCp2 = sideSeam.intersectsY(points.pocketbagBottomRight.y).pop()
|
2021-03-13 09:58:17 +01:00
|
|
|
points.pocketbagBottom = points.pocketbagBottomRight.shiftFractionTowards(
|
2021-03-14 18:02:22 +01:00
|
|
|
points.pocketbagBottomCp2,
|
2021-03-13 09:58:17 +01:00
|
|
|
0.5
|
|
|
|
)
|
2021-03-14 18:02:22 +01:00
|
|
|
points.pocketbagBottomCp1 = points.slantCurveCp2.rotate(180, points.slantCurveEnd)
|
2021-03-13 09:58:17 +01:00
|
|
|
|
2021-04-09 18:33:53 +02:00
|
|
|
// Construct facing boundary
|
|
|
|
points.pocketFacingTop = points.slantTop.shiftFractionTowards(points.pocketbagTopRight, 0.35)
|
|
|
|
points.facingDirection = points.slantCurveStart.shift(
|
|
|
|
0,
|
|
|
|
points.slantTop.dist(points.pocketFacingTop)
|
|
|
|
)
|
|
|
|
// YOLO
|
|
|
|
points.pocketFacingBottom = new Path()
|
|
|
|
.move(points.pocketFacingTop)
|
|
|
|
.line(points.pocketFacingTop.shiftFractionTowards(points.facingDirection, 4))
|
|
|
|
.intersects(
|
|
|
|
new Path()
|
|
|
|
.move(points.slantCurveStart)
|
|
|
|
.curve(points.slantCurveCp1, points.slantCurveCp2, points.slantCurveEnd)
|
|
|
|
.curve(points.pocketbagBottomCp1, points.pocketbagBottomCp2, points.pocketbagBottom)
|
|
|
|
.line(points.pocketbagBottomRight)
|
|
|
|
)
|
|
|
|
.pop()
|
|
|
|
|
2021-03-10 20:27:50 +01:00
|
|
|
// Draw path
|
2021-03-13 09:58:17 +01:00
|
|
|
paths.seam = drawPath().close().attr('class', 'fabric')
|
|
|
|
|
|
|
|
// Store waistband length
|
|
|
|
store.set('waistbandFront', points.styleWaistIn.dist(points.styleWaistOut))
|
|
|
|
store.set('waistbandFly', points.styleWaistIn.dist(points.flyTop))
|
2021-01-30 18:16:16 +01:00
|
|
|
|
2021-01-30 16:30:45 +01:00
|
|
|
if (complete) {
|
2021-03-10 20:27:50 +01:00
|
|
|
points.titleAnchor = new Point(points.knee.x, points.fork.y)
|
|
|
|
macro('title', {
|
|
|
|
at: points.titleAnchor,
|
|
|
|
nr: 2,
|
|
|
|
title: 'front'
|
|
|
|
})
|
2021-03-13 09:58:17 +01:00
|
|
|
snippets.logo = new Snippet('logo', points.titleAnchor.shiftFractionTowards(points.knee, 0.666))
|
2021-03-10 20:27:50 +01:00
|
|
|
points.topPleat = utils.beamsIntersect(
|
|
|
|
points.styleWaistIn,
|
|
|
|
points.styleWaistOut,
|
|
|
|
points.knee,
|
|
|
|
points.grainlineBottom
|
|
|
|
)
|
2021-03-14 18:02:22 +01:00
|
|
|
points.slantBottomNotch = new Path()
|
|
|
|
.move(points.slantCurveStart)
|
|
|
|
.curve(points.slantCurveCp1, points.slantCurveCp2, points.slantCurveEnd)
|
|
|
|
.intersectsY(points.slantBottom.y)
|
|
|
|
.pop()
|
2021-04-09 18:33:53 +02:00
|
|
|
points.slantTopNotch = points.slantTop.shiftFractionTowards(points.slantCurveStart, 0.1)
|
|
|
|
store.set('slantTopNotchDistance', points.slantTop.dist(points.slantTopNotch))
|
2021-03-10 20:27:50 +01:00
|
|
|
macro('sprinkle', {
|
|
|
|
snippet: 'notch',
|
2021-04-09 18:39:56 +02:00
|
|
|
on: [
|
|
|
|
'slantBottomNotch',
|
|
|
|
'slantTopNotch',
|
|
|
|
'topPleat',
|
|
|
|
'grainlineBottom',
|
|
|
|
'flyBottom',
|
|
|
|
'flyExtensionBottom'
|
|
|
|
]
|
2021-03-10 20:27:50 +01:00
|
|
|
})
|
2021-03-14 18:02:22 +01:00
|
|
|
let Jseam = new Path()
|
|
|
|
.move(points.flyCurveStart)
|
|
|
|
.curve(points.flyCurveCp2, points.flyCurveCp1, points.flyBottom)
|
|
|
|
paths.Jseam = new Path()
|
|
|
|
.move(points.flyTop)
|
|
|
|
.join(Jseam)
|
|
|
|
.attr('class', 'dashed')
|
|
|
|
.attr('data-text', 'Left panel only')
|
|
|
|
.attr('data-text-class', 'center')
|
2021-03-13 09:58:17 +01:00
|
|
|
paths.pocketBag = new Path()
|
2021-03-14 18:02:22 +01:00
|
|
|
.move(points.slantTop)
|
|
|
|
.line(points.slantCurveStart)
|
|
|
|
.curve(points.slantCurveCp1, points.slantCurveCp2, points.slantCurveEnd)
|
|
|
|
.curve(points.pocketbagBottomCp1, points.pocketbagBottomCp2, points.pocketbagBottom)
|
2021-03-13 09:58:17 +01:00
|
|
|
.line(points.pocketbagBottomRight)
|
2021-03-14 18:02:22 +01:00
|
|
|
.line(points.pocketbagTopRight)
|
2021-04-09 18:33:53 +02:00
|
|
|
.move(points.pocketFacingTop)
|
|
|
|
.line(points.pocketFacingBottom)
|
2021-03-13 09:58:17 +01:00
|
|
|
.attr('class', 'lining dashed')
|
2021-03-10 20:27:50 +01:00
|
|
|
|
2021-04-11 17:15:58 +02:00
|
|
|
// Bartack
|
|
|
|
macro('bartack', {
|
|
|
|
anchor: points.slantTopNotch,
|
|
|
|
angle: points.slantTopNotch.angle(points.slantCurveStart) + 90,
|
|
|
|
length: sa ? sa / 1.5 : 7.5,
|
|
|
|
suffix: 'slantTop'
|
|
|
|
})
|
|
|
|
macro('bartack', {
|
|
|
|
anchor: points.slantBottomNotch,
|
|
|
|
length: sa ? sa / 2 : 5,
|
|
|
|
suffix: 'slantBottom'
|
|
|
|
})
|
|
|
|
macro('bartackFractionAlong', {
|
|
|
|
path: Jseam.reverse(),
|
|
|
|
start: 0,
|
|
|
|
end: 0.1,
|
|
|
|
suffix: 'stom'
|
|
|
|
})
|
|
|
|
|
2021-01-30 16:30:45 +01:00
|
|
|
if (sa) {
|
2021-03-13 09:58:17 +01:00
|
|
|
paths.sa = drawPath()
|
|
|
|
.offset(sa)
|
|
|
|
.join(
|
|
|
|
new Path()
|
|
|
|
.move(points.floorOut)
|
|
|
|
.line(points.floorIn)
|
|
|
|
.offset(sa * 3)
|
|
|
|
)
|
|
|
|
.close()
|
|
|
|
.trim()
|
|
|
|
.attr('class', 'fabric sa')
|
2021-01-30 16:30:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (paperless) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return part
|
|
|
|
}
|