1
0
Fork 0
freesewing/packages/carlita/src/side.js

127 lines
3.2 KiB
JavaScript
Raw Normal View History

export default function (part) {
2019-04-06 12:30:11 +02:00
let {
paperless,
sa,
snippets,
Snippet,
store,
complete,
points,
macro,
Point,
paths,
2021-04-24 10:16:31 +02:00
Path,
2019-08-03 15:03:33 +02:00
} = part.shorthand()
2019-04-06 12:30:11 +02:00
// Give points their original names
2019-08-03 15:03:33 +02:00
for (let i of store.get('side')) points[i] = points[i + 'Rot2'].clone()
2019-04-06 12:30:11 +02:00
// Clean up
for (let i in paths) {
if (['frontArmhole','frontCollar'].indexOf(i) === -1) delete paths[i]
}
2019-08-03 15:03:33 +02:00
for (let i in snippets) delete snippets[i]
2019-04-06 12:30:11 +02:00
points.anchor = points.armholePitchRot2.clone()
2019-04-06 12:30:11 +02:00
paths.saBase = new Path()
.move(points.hem)
.line(points.seat)
.curve(points.seatCp2, points.waistCp1, points.waist)
.curve_(points.waistCp2, points.armhole)
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
._curve(points.bustPointCp1, points.bustPoint)
.curve(points.bustPointCp2, points.psWaistCp1, points.psWaist)
2019-08-03 15:03:33 +02:00
.line(points.psHem)
paths.seam = paths.saBase.clone().line(points.hem).close().attr('class', 'fabric')
2019-04-06 12:30:11 +02:00
if (complete) {
2019-08-03 15:03:33 +02:00
points.title = points.bustPoint.shiftFractionTowards(points.waist, 0.5)
macro('title', {
2019-04-06 12:30:11 +02:00
at: points.title,
2019-08-03 15:03:33 +02:00
nr: '1b',
2021-04-24 10:16:31 +02:00
title: 'side',
2019-08-03 15:03:33 +02:00
})
2019-04-06 12:30:11 +02:00
2019-08-03 15:03:33 +02:00
points.logo = points.psHem.shiftFractionTowards(points.seat, 0.5)
snippets.logo = new Snippet('logo', points.logo)
2019-04-06 12:30:11 +02:00
2019-08-03 15:03:33 +02:00
points.grainlineFrom = points.psHem.shiftFractionTowards(points.hem, 0.5)
points.grainlineTo = new Point(points.grainlineFrom.x, points.armholePitchCp1.y)
macro('grainline', {
2019-04-06 12:30:11 +02:00
from: points.grainlineFrom,
2021-04-24 10:16:31 +02:00
to: points.grainlineTo,
2019-08-03 15:03:33 +02:00
})
snippets.bust = new Snippet('notch', points.bustPoint)
2019-04-06 12:30:11 +02:00
if (sa) {
paths.sa = paths.saBase
.offset(sa)
.line(points.psHem.shift(-90, 3 * sa).shift(180, sa))
.line(points.hem.shift(-90, 3 * sa).shift(0, sa))
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric sa')
2019-04-06 12:30:11 +02:00
}
2019-04-06 13:15:59 +02:00
if (paperless) {
2019-08-03 15:03:33 +02:00
macro('vd', {
2019-04-06 13:15:59 +02:00
from: points.psHem,
to: points.psWaist,
2021-04-24 10:16:31 +02:00
x: points.psWaist.x - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-04-06 13:15:59 +02:00
from: points.psHem,
to: points.bustPoint,
2021-04-24 10:16:31 +02:00
x: points.bustPoint.x - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-04-06 13:15:59 +02:00
from: points.hem,
to: points.seat,
2021-04-24 10:16:31 +02:00
x: points.hem.x + sa + 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-04-06 13:15:59 +02:00
from: points.hem,
to: points.waist,
2021-04-24 10:16:31 +02:00
x: points.hem.x + sa + 30,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-04-06 13:15:59 +02:00
from: points.hem,
to: points.armhole,
2021-04-24 10:16:31 +02:00
x: points.hem.x + sa + 45,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-04-06 13:15:59 +02:00
from: points.hem,
to: points.armholePitch,
2021-04-24 10:16:31 +02:00
x: points.hem.x + sa + 60,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-04-06 13:15:59 +02:00
from: points.psWaist,
2021-04-24 10:16:31 +02:00
to: points.waist,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-04-06 13:15:59 +02:00
from: points.bustPoint,
to: points.waist,
2021-04-24 10:16:31 +02:00
y: points.bustPoint.y,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-04-06 13:15:59 +02:00
from: points.bustPoint,
to: points.armholePitch,
2021-04-24 10:16:31 +02:00
y: points.armholePitch.y - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-04-06 13:15:59 +02:00
from: points.bustPoint,
to: points.armhole,
2021-04-24 10:16:31 +02:00
y: points.armholePitch.y - sa - 30,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-04-06 13:15:59 +02:00
from: points.psHem,
to: points.hem,
2021-04-24 10:16:31 +02:00
y: points.hem.y + 3 * sa + 15,
2019-08-03 15:03:33 +02:00
})
2019-04-06 13:15:59 +02:00
}
2019-04-06 12:30:11 +02:00
}
2019-08-03 15:03:33 +02:00
return part
2019-04-06 12:30:11 +02:00
}