2020-06-28 13:08:33 +02:00
|
|
|
export default function (part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
let {
|
|
|
|
paperless,
|
|
|
|
sa,
|
|
|
|
snippets,
|
|
|
|
Snippet,
|
|
|
|
utils,
|
|
|
|
store,
|
|
|
|
complete,
|
|
|
|
points,
|
|
|
|
measurements,
|
|
|
|
options,
|
|
|
|
macro,
|
|
|
|
Point,
|
|
|
|
paths,
|
|
|
|
Path
|
|
|
|
} = part.shorthand()
|
2019-03-16 11:39:06 +01:00
|
|
|
|
|
|
|
// Back vent(s)
|
2019-08-03 15:03:33 +02:00
|
|
|
let ventY = points.cbHips.y - points.cbWaistCp2.dy(points.cbHips) * options.backVentLength
|
|
|
|
if (options.backVent === 1) {
|
|
|
|
// Single back vent
|
2019-03-16 11:39:06 +01:00
|
|
|
// Vent tip
|
|
|
|
points.ventStart = utils.curveIntersectsY(
|
|
|
|
points.cbHips,
|
|
|
|
points.cbHipsCp1,
|
|
|
|
points.cbWaistCp2,
|
|
|
|
points.cbWaist,
|
|
|
|
ventY
|
2019-08-03 15:03:33 +02:00
|
|
|
)
|
2019-03-16 11:39:06 +01:00
|
|
|
paths.ventBase = new Path()
|
|
|
|
.move(points.cbWaist)
|
|
|
|
.curve(points.cbWaistCp2, points.cbHipsCp1, points.cbHips)
|
|
|
|
.split(points.ventStart)
|
|
|
|
.pop()
|
2019-08-03 15:03:33 +02:00
|
|
|
.line(points.cbHem)
|
2020-06-28 13:08:33 +02:00
|
|
|
paths.vent = paths.ventBase.offset(measurements.neck / 10)
|
2019-08-03 15:03:33 +02:00
|
|
|
paths.vent.render = false
|
2019-03-16 11:39:06 +01:00
|
|
|
points.ventSlopeStart = utils.lineIntersectsCurve(
|
|
|
|
paths.vent.start(),
|
2020-06-28 13:08:33 +02:00
|
|
|
paths.vent.start().shift(10, measurements.neck / 5),
|
2019-03-16 11:39:06 +01:00
|
|
|
points.cbHips,
|
|
|
|
points.cbHipsCp1,
|
|
|
|
points.cbWaistCp2,
|
|
|
|
points.cbWaist
|
2019-08-03 15:03:33 +02:00
|
|
|
)
|
|
|
|
} else if (options.backVent === 2) {
|
|
|
|
// Double back vent
|
2019-03-16 11:39:06 +01:00
|
|
|
// Vent tip
|
|
|
|
points.ventStart = utils.curveIntersectsY(
|
|
|
|
points.hips,
|
|
|
|
points.hipsCp2,
|
|
|
|
points.waistCp1,
|
|
|
|
points.waist,
|
|
|
|
ventY
|
2019-08-03 15:03:33 +02:00
|
|
|
)
|
2019-03-16 11:39:06 +01:00
|
|
|
paths.ventBase = new Path()
|
|
|
|
.move(points.waist)
|
|
|
|
.curve(points.waistCp1, points.hipsCp2, points.hips)
|
|
|
|
.split(points.ventStart)
|
|
|
|
.pop()
|
2019-08-03 15:03:33 +02:00
|
|
|
.line(points.hem)
|
2020-06-28 13:08:33 +02:00
|
|
|
paths.vent = paths.ventBase.offset(measurements.neck / -10)
|
2019-08-03 15:03:33 +02:00
|
|
|
paths.vent.render = false
|
2019-03-16 11:39:06 +01:00
|
|
|
points.ventSlopeStart = utils.lineIntersectsCurve(
|
|
|
|
paths.vent.start(),
|
2020-06-28 13:08:33 +02:00
|
|
|
paths.vent.start().shift(170, measurements.neck / 5),
|
2019-03-16 11:39:06 +01:00
|
|
|
points.hips,
|
|
|
|
points.hipsCp2,
|
|
|
|
points.waistCp1,
|
|
|
|
points.waist
|
2019-08-03 15:03:33 +02:00
|
|
|
)
|
2019-03-16 11:39:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Store shoulder slope
|
2019-08-03 15:03:33 +02:00
|
|
|
store.set('shoulderSlope', Math.abs(points.neck.angle(points.shoulder) - 360))
|
2019-03-16 11:39:06 +01:00
|
|
|
|
|
|
|
// Clean up - Remove this to understand what's going on
|
2019-08-03 15:03:33 +02:00
|
|
|
for (let i of Object.keys(paths)) if (i !== 'vent') delete paths[i]
|
|
|
|
for (let i of Object.keys(snippets)) delete snippets[i]
|
2019-03-16 11:39:06 +01:00
|
|
|
|
|
|
|
// Paths
|
|
|
|
if (options.backVent === 2) {
|
|
|
|
paths.saBase = paths.vent
|
|
|
|
.clone()
|
|
|
|
.reverse()
|
|
|
|
.line(points.ventSlopeStart)
|
2019-08-03 15:03:33 +02:00
|
|
|
.join(
|
|
|
|
new Path()
|
|
|
|
.move(points.hips)
|
|
|
|
.curve(points.hipsCp2, points.waistCp1, points.waist)
|
|
|
|
.split(points.ventSlopeStart)
|
|
|
|
.pop()
|
2019-03-16 11:39:06 +01:00
|
|
|
)
|
2019-08-03 15:03:33 +02:00
|
|
|
paths.saBase.render = true
|
2019-03-16 11:39:06 +01:00
|
|
|
} else {
|
|
|
|
paths.saBase = new Path()
|
|
|
|
.move(points.hem)
|
|
|
|
.line(points.hips)
|
|
|
|
.curve(points.hipsCp2, points.waistCp1, points.waist)
|
|
|
|
}
|
|
|
|
paths.saBase
|
|
|
|
.curve(points.waistCp2, points.bsArmholeHollowCp2, points.bsArmholeHollow)
|
|
|
|
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
|
|
|
|
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
|
|
|
|
.line(points.neck)
|
2019-08-03 15:03:33 +02:00
|
|
|
.curve_(points.neckCp2, points.cbNeck)
|
|
|
|
if (options.centerBackDart > 0)
|
|
|
|
paths.saBase = paths.saBase._curve(points.cbChestCp1, points.cbChest)
|
|
|
|
else paths.saBase = paths.saBase.line(points.cbChest)
|
|
|
|
paths.saBase = paths.saBase.curve(points.cbChestCp2, points.cbWaistCp1, points.cbWaist)
|
2019-03-16 11:39:06 +01:00
|
|
|
if (options.backVent === 1) {
|
|
|
|
paths.saBase = paths.saBase
|
|
|
|
.join(
|
|
|
|
new Path()
|
|
|
|
.move(points.cbWaist)
|
|
|
|
.curve(points.cbWaistCp2, points.cbHipsCp1, points.cbHips)
|
|
|
|
.line(points.cbHem)
|
|
|
|
.split(points.ventSlopeStart)
|
|
|
|
.shift()
|
|
|
|
)
|
|
|
|
.line(paths.vent.start())
|
|
|
|
.join(paths.vent)
|
|
|
|
} else {
|
2019-08-03 15:03:33 +02:00
|
|
|
paths.saBase.curve(points.cbWaistCp2, points.cbHipsCp1, points.cbHips).line(points.cbHem)
|
2019-03-16 11:39:06 +01:00
|
|
|
}
|
2019-08-03 15:03:33 +02:00
|
|
|
paths.saBase.render = false
|
2019-03-16 11:39:06 +01:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
if (options.backVent === 2) paths.hemBase = new Path().move(points.cbHem).line(paths.vent.end())
|
|
|
|
else if (options.backVent === 1)
|
|
|
|
paths.hemBase = new Path().move(paths.vent.end()).line(points.hem)
|
|
|
|
else paths.hemBase = new Path().move(points.cbHem).line(points.hem)
|
|
|
|
paths.hemBase.render = false
|
2019-03-16 11:39:06 +01:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
paths.seam = paths.saBase.join(paths.hemBase).attr('class', 'fabric')
|
2019-03-16 11:39:06 +01:00
|
|
|
|
|
|
|
if (complete) {
|
2019-03-16 17:11:03 +01:00
|
|
|
// Logo
|
2019-08-03 15:03:33 +02:00
|
|
|
points.logo = new Point(points.title.x, points.armholeHollow.y)
|
|
|
|
snippets.logo = new Snippet('logo', points.logo)
|
2019-03-16 17:11:03 +01:00
|
|
|
// Notches
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('sprinkle', {
|
|
|
|
snippet: 'notch',
|
|
|
|
on: ['neck', 'shoulder', 'armholePitch', 'cbWaist', 'waist']
|
|
|
|
})
|
2019-03-16 17:11:03 +01:00
|
|
|
// Grainline
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('grainline', {
|
2019-03-16 17:11:03 +01:00
|
|
|
from: new Point(points.neck.x, points.hips.y),
|
|
|
|
to: points.neck
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-03-16 11:39:06 +01:00
|
|
|
|
|
|
|
if (sa) {
|
|
|
|
paths.sa = paths.saBase
|
|
|
|
.offset(sa)
|
|
|
|
.join(paths.hemBase.offset(sa * 3))
|
|
|
|
.close()
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'fabric sa')
|
2019-03-16 11:39:06 +01:00
|
|
|
}
|
2019-03-17 11:33:51 +01:00
|
|
|
|
|
|
|
if (paperless) {
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('hd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: points.cbNeck,
|
|
|
|
to: points.neck,
|
2019-08-03 15:03:33 +02:00
|
|
|
y: points.neck.y - 15 - sa
|
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: points.cbChest,
|
|
|
|
to: points.neck,
|
2019-08-03 15:03:33 +02:00
|
|
|
y: points.neck.y - 30 - sa
|
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: points.cbChest,
|
|
|
|
to: points.armholePitch,
|
2019-08-03 15:03:33 +02:00
|
|
|
y: points.neck.y - 45 - sa
|
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: points.cbChest,
|
|
|
|
to: points.shoulder,
|
2019-08-03 15:03:33 +02:00
|
|
|
y: points.neck.y - 60 - sa
|
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: points.cbChest,
|
|
|
|
to: points.bsArmholeHollow,
|
2019-08-03 15:03:33 +02:00
|
|
|
y: points.neck.y - 75 - sa
|
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: points.bsArmholeHollow,
|
|
|
|
to: points.armholePitch,
|
2019-08-03 15:03:33 +02:00
|
|
|
x: points.bsArmholeHollow.x + sa + 15
|
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: points.bsArmholeHollow,
|
|
|
|
to: points.shoulder,
|
2019-08-03 15:03:33 +02:00
|
|
|
x: points.bsArmholeHollow.x + sa + 30
|
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: points.hem,
|
|
|
|
to: points.hips,
|
2019-08-03 15:03:33 +02:00
|
|
|
x: points.hem.x + sa + 15
|
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: points.hem,
|
|
|
|
to: points.waist,
|
2019-08-03 15:03:33 +02:00
|
|
|
x: points.hem.x + sa + 30
|
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: points.hem,
|
|
|
|
to: points.bsArmholeHollow,
|
2019-08-03 15:03:33 +02:00
|
|
|
x: points.hem.x + sa + 45
|
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: paths.vent.start(),
|
|
|
|
to: points.ventSlopeStart,
|
2019-08-03 15:03:33 +02:00
|
|
|
y: points.ventSlopeStart.y + 25
|
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: paths.vent.end(),
|
|
|
|
to: points.hem,
|
2019-08-03 15:03:33 +02:00
|
|
|
y: points.hem.y + 3 * sa + 15
|
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: paths.vent.end(),
|
|
|
|
to: paths.vent.start(),
|
2019-08-03 15:03:33 +02:00
|
|
|
x: paths.vent.end().x - sa - 15
|
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: paths.vent.end(),
|
|
|
|
to: points.ventSlopeStart,
|
2019-08-03 15:03:33 +02:00
|
|
|
x: paths.vent.end().x - sa - 30
|
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: paths.vent.end(),
|
|
|
|
to: points.cbWaist,
|
2019-08-03 15:03:33 +02:00
|
|
|
x: paths.vent.end().x - sa - 45
|
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: paths.vent.end(),
|
|
|
|
to: points.cbChest,
|
2019-08-03 15:03:33 +02:00
|
|
|
x: paths.vent.end().x - sa - 60
|
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: paths.vent.end(),
|
|
|
|
to: points.cbNeck,
|
2019-08-03 15:03:33 +02:00
|
|
|
x: paths.vent.end().x - sa - 75
|
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: paths.vent.end(),
|
|
|
|
to: points.neck,
|
2019-08-03 15:03:33 +02:00
|
|
|
x: paths.vent.end().x - sa - 90
|
|
|
|
})
|
|
|
|
macro('ld', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: points.cbWaist,
|
|
|
|
to: points.waist
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('ld', {
|
2019-03-17 11:33:51 +01:00
|
|
|
from: points.neck,
|
|
|
|
to: points.shoulder,
|
|
|
|
d: -15
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-03-17 11:33:51 +01:00
|
|
|
}
|
2019-03-16 11:39:06 +01:00
|
|
|
}
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return part
|
2019-03-16 11:39:06 +01:00
|
|
|
}
|