2018-12-20 11:41:35 +01:00
|
|
|
export default function(part) {
|
|
|
|
// Remove clutter
|
|
|
|
let pocket = part.paths.pocket;
|
|
|
|
part.paths = {};
|
|
|
|
part.snippets = {};
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2019-05-10 13:14:31 +02:00
|
|
|
let {
|
|
|
|
utils,
|
|
|
|
store,
|
|
|
|
sa,
|
|
|
|
points,
|
|
|
|
Path,
|
|
|
|
paths,
|
|
|
|
complete,
|
|
|
|
paperless,
|
|
|
|
macro,
|
|
|
|
debug
|
|
|
|
} = part.shorthand();
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
paths.seam = pocket
|
|
|
|
.line(points.cfRibbing)
|
|
|
|
.line(points.pocketHem)
|
|
|
|
.attr("class", "fabric", true);
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
store.set("facingWidth", points.pocketHem.dist(points.pocketTip) / 2);
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
let facing = new Path()
|
|
|
|
.move(points.pocketTip)
|
|
|
|
.curve(points.pocketTip, points.pocketTopCp, points.pocketTop)
|
|
|
|
.offset(store.get("facingWidth") * -1);
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
points._tmp = facing.shiftAlong(2);
|
|
|
|
points.facingEnd = utils.beamsIntersect(
|
|
|
|
points._tmp,
|
|
|
|
facing.start(),
|
|
|
|
points.pocketHem,
|
|
|
|
points.pocketTip
|
|
|
|
);
|
|
|
|
paths.facing = new Path()
|
|
|
|
.move(points.facingEnd)
|
|
|
|
.line(facing.start())
|
|
|
|
.join(facing)
|
|
|
|
.attr("class", " fabric help");
|
2018-09-21 21:30:20 +02:00
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
// Complete pattern?
|
|
|
|
if (complete) {
|
|
|
|
macro("grainline", {
|
|
|
|
from: points.cfRibbing.shift(0, 15),
|
|
|
|
to: points.pocketCf.shift(0, 15)
|
|
|
|
});
|
2019-05-10 13:14:31 +02:00
|
|
|
points.title = points.cfRibbing.shiftFractionTowards(points.pocketTop, 0.5);
|
2018-12-20 11:41:35 +01:00
|
|
|
macro("title", { at: points.title, nr: 4, title: "pocket" });
|
|
|
|
if (sa) {
|
|
|
|
paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
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) {
|
|
|
|
macro("hd", {
|
|
|
|
from: points.cfRibbing,
|
|
|
|
to: points.pocketTop,
|
|
|
|
y: points.cfRibbing.y + 15 + sa
|
|
|
|
});
|
|
|
|
macro("hd", {
|
|
|
|
from: points.cfRibbing,
|
|
|
|
to: points.pocketTip,
|
|
|
|
y: points.cfRibbing.y + 30 + sa
|
|
|
|
});
|
|
|
|
macro("vd", {
|
|
|
|
from: points.pocketHem,
|
|
|
|
to: points.pocketTip,
|
|
|
|
x: points.pocketTip.x + 15 + sa
|
|
|
|
});
|
|
|
|
macro("vd", {
|
|
|
|
from: points.pocketHem,
|
|
|
|
to: points.pocketTop,
|
|
|
|
x: points.cfRibbing.x - 15 - sa
|
|
|
|
});
|
2018-09-21 21:30:20 +02:00
|
|
|
}
|
|
|
|
|
2018-12-20 11:41:35 +01:00
|
|
|
return part;
|
2019-05-10 13:14:31 +02:00
|
|
|
}
|