2019-04-07 17:01:58 +02:00
|
|
|
export default function(part) {
|
|
|
|
let {
|
|
|
|
paperless,
|
|
|
|
sa,
|
|
|
|
complete,
|
|
|
|
points,
|
|
|
|
macro,
|
|
|
|
paths,
|
2019-05-10 13:14:31 +02:00
|
|
|
Path
|
2019-04-07 17:01:58 +02:00
|
|
|
} = part.shorthand();
|
|
|
|
|
|
|
|
paths.hint = paths.seam.clone().attr("class", "dashed stroke-sm");
|
|
|
|
|
|
|
|
paths.outset = new Path()
|
|
|
|
.move(points.tipLeft)
|
|
|
|
.curve(points.tipLeftCp2, points.outerMidCp1, points.outerMid)
|
|
|
|
.curve(points.outerMidCp2, points.tipRightCp1, points.tipRight)
|
|
|
|
.attr("class", "lining");
|
|
|
|
//.offset(1.5)
|
|
|
|
points.outsetStart = paths.outset.shiftAlong(5);
|
|
|
|
points.outsetEnd = paths.outset.reverse().shiftAlong(5);
|
|
|
|
paths.outset = paths.outset
|
|
|
|
.split(points.outsetStart)
|
|
|
|
.pop()
|
|
|
|
.split(points.outsetEnd)
|
2019-07-07 13:08:22 +02:00
|
|
|
.shift();
|
|
|
|
// We check for sa here because it's a good way to sidestep issue #19
|
|
|
|
if (sa) paths.outset = paths.outset.offset(1.5);
|
2019-04-07 17:01:58 +02:00
|
|
|
|
|
|
|
paths.inset = new Path()
|
|
|
|
.move(points.tipLeft)
|
|
|
|
.curve(points.tipLeftCp1, points.innerMidCp2, points.innerMid)
|
|
|
|
.curve(points.innerMidCp1, points.tipRightCp2, points.tipRight)
|
|
|
|
.attr("class", "various");
|
|
|
|
//.offset(1.5)
|
|
|
|
points.insetStart = paths.inset.shiftAlong(5);
|
|
|
|
points.insetEnd = paths.inset.reverse().shiftAlong(5);
|
|
|
|
paths.inset = paths.inset
|
|
|
|
.split(points.insetStart)
|
|
|
|
.pop()
|
|
|
|
.split(points.insetEnd)
|
2019-07-07 13:08:22 +02:00
|
|
|
.shift();
|
|
|
|
// We check for sa here because it's a good way to sidestep issue #19
|
|
|
|
if (sa) paths.inset = paths.inset.offset(1.5);
|
2019-04-07 17:01:58 +02:00
|
|
|
paths.inset.render = false;
|
|
|
|
paths.outset.render = false;
|
|
|
|
|
|
|
|
paths.hint = paths.seam.clone().attr("class", "dashed stroke-sm");
|
|
|
|
paths.seam = paths.outset
|
|
|
|
.clone()
|
|
|
|
.line(paths.inset.end())
|
|
|
|
.join(paths.inset.reverse())
|
|
|
|
.line(paths.outset.start())
|
|
|
|
.close()
|
|
|
|
.attr("class", "interfacing");
|
|
|
|
|
2019-04-08 18:25:01 +02:00
|
|
|
// Clean up
|
|
|
|
for (let i of Object.keys(paths)) {
|
|
|
|
if (["seam", "inset", "outset"].indexOf(i) === -1) delete paths[i];
|
|
|
|
}
|
|
|
|
|
2019-04-07 17:01:58 +02:00
|
|
|
if (complete) {
|
2019-04-08 18:25:01 +02:00
|
|
|
points.title = points.innerMid.shiftFractionTowards(
|
|
|
|
points.outerMidCp2,
|
|
|
|
0.35
|
|
|
|
);
|
|
|
|
macro("title", {
|
|
|
|
at: points.title,
|
|
|
|
nr: 5,
|
|
|
|
title: "brimInterfacing"
|
|
|
|
});
|
|
|
|
macro("grainline", {
|
|
|
|
from: points.outerMid,
|
|
|
|
to: points.innerMid
|
|
|
|
});
|
|
|
|
|
|
|
|
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
2019-04-07 17:01:58 +02:00
|
|
|
|
|
|
|
if (paperless) {
|
2019-04-08 18:25:01 +02:00
|
|
|
macro("hd", {
|
|
|
|
from: paths.seam.edge("left"),
|
|
|
|
to: paths.seam.edge("right"),
|
|
|
|
y: points.tipLeft.y - sa - 15
|
|
|
|
});
|
|
|
|
macro("vd", {
|
|
|
|
from: paths.outset.edge("bottom"),
|
|
|
|
to: paths.inset.edge("bottom"),
|
|
|
|
x: points.innerMid.x - 15
|
|
|
|
});
|
|
|
|
macro("vd", {
|
|
|
|
from: paths.outset.edge("bottom"),
|
|
|
|
to: paths.inset.edge("topRight"),
|
|
|
|
x: points.tipRight.x + sa + 18
|
|
|
|
});
|
2019-04-07 17:01:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return part;
|
|
|
|
}
|