2018-08-06 16:19:12 +02:00
|
|
|
import freesewing from "freesewing";
|
|
|
|
|
|
|
|
var sleeve = {
|
2018-08-11 14:13:40 +02:00
|
|
|
draft: function(part) {
|
2018-08-06 16:19:12 +02:00
|
|
|
// prettier-ignore
|
2018-08-08 14:38:19 +02:00
|
|
|
let {debug, store, units, sa, measurements, options, Point, points, Path, paths, Snippet, snippets, final, paperless, macro} = part.shorthand();
|
2018-08-06 16:19:12 +02:00
|
|
|
|
2018-08-08 16:12:56 +02:00
|
|
|
// Wrist
|
|
|
|
let top = paths.sleevecap.bbox().topLeft.y;
|
|
|
|
debug("Sleevecap height is ", units(Math.abs(top)));
|
2018-08-09 11:44:24 +02:00
|
|
|
debug("Sleeve width is ", units(points.bicepsRight.x * 2));
|
2018-08-08 16:12:56 +02:00
|
|
|
points.centerWrist = new Point(
|
|
|
|
0,
|
|
|
|
top + measurements.shoulderToWrist * (1 + options.sleeveLengthBonus)
|
|
|
|
);
|
|
|
|
points.wristRight = points.centerWrist.shift(
|
|
|
|
0,
|
|
|
|
(measurements.wristCircumference * (1 + options.cuffEase)) / 2
|
|
|
|
);
|
|
|
|
points.wristLeft = points.wristRight.rotate(180, points.centerWrist);
|
|
|
|
|
2018-08-08 16:41:16 +02:00
|
|
|
// Paths
|
|
|
|
paths.sleevecap.render = false;
|
2018-08-08 16:12:56 +02:00
|
|
|
paths.seam = new Path()
|
2018-08-09 11:44:24 +02:00
|
|
|
.move(points.bicepsLeft)
|
2018-08-08 16:12:56 +02:00
|
|
|
.move(points.wristLeft)
|
|
|
|
.move(points.wristRight)
|
2018-08-09 11:44:24 +02:00
|
|
|
.line(points.bicepsRight)
|
2018-08-08 16:12:56 +02:00
|
|
|
.join(paths.sleevecap)
|
2018-08-09 11:44:24 +02:00
|
|
|
.close()
|
|
|
|
.attr("class", "fabric");
|
2018-08-06 16:19:12 +02:00
|
|
|
|
|
|
|
// Anchor point for sampling
|
|
|
|
points.gridAnchor = points.origin;
|
|
|
|
points.test = new Point(10, 10);
|
|
|
|
|
|
|
|
// Final?
|
|
|
|
if (final) {
|
2018-08-08 16:41:16 +02:00
|
|
|
points.logo = points.centerBiceps.shiftFractionTowards(
|
2018-08-07 16:42:48 +02:00
|
|
|
points.centerWrist,
|
|
|
|
0.3
|
|
|
|
);
|
2018-08-08 16:41:16 +02:00
|
|
|
snippets.logo = new Snippet("logo", points.logo);
|
|
|
|
macro("title", { at: points.centerBiceps, nr: 3, title: "sleeve" });
|
2018-08-10 18:51:44 +02:00
|
|
|
macro("grainline", { from: points.centerWrist, to: points.centerBiceps });
|
2018-08-20 14:33:29 +02:00
|
|
|
points.scaleboxAnchor = points.scalebox = points.centerBiceps.shiftFractionTowards(
|
|
|
|
points.centerWrist,
|
|
|
|
0.5
|
|
|
|
);
|
|
|
|
macro("scalebox", { at: points.scalebox });
|
2018-08-08 16:41:16 +02:00
|
|
|
|
|
|
|
points.sleeveTip = paths.sleevecap.shiftFractionAlong(0.5);
|
|
|
|
points.frontNotch = paths.sleevecap.shiftAlong(
|
|
|
|
paths.sleevecap.length() / 2 -
|
|
|
|
store.get("frontShoulderToArmholePitch") -
|
|
|
|
store.get("sleevecapEase") / 2
|
|
|
|
);
|
|
|
|
points.backNotch = paths.sleevecap.shiftAlong(
|
|
|
|
paths.sleevecap.length() / 2 +
|
|
|
|
store.get("backShoulderToArmholePitch") +
|
|
|
|
store.get("sleevecapEase") / 2
|
|
|
|
);
|
|
|
|
snippets.frontNotch = new Snippet("notch", points.frontNotch);
|
|
|
|
snippets.backNotch = new Snippet("bnotch", points.backNotch);
|
|
|
|
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
2018-08-06 16:19:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Paperless?
|
|
|
|
if (paperless) {
|
2018-08-09 11:44:24 +02:00
|
|
|
macro("vd", {
|
|
|
|
from: points.wristLeft,
|
|
|
|
to: points.bicepsLeft,
|
|
|
|
x: points.bicepsLeft.x - sa - 15
|
|
|
|
});
|
|
|
|
macro("vd", {
|
|
|
|
from: points.wristLeft,
|
|
|
|
to: points.sleeveTip,
|
|
|
|
x: points.bicepsLeft.x - sa - 30
|
|
|
|
});
|
|
|
|
macro("hd", {
|
|
|
|
from: points.bicepsLeft,
|
|
|
|
to: points.bicepsRight,
|
|
|
|
y: points.sleeveTip.y - sa - 30
|
|
|
|
});
|
|
|
|
macro("pd", {
|
|
|
|
path: paths.sleevecap.reverse(),
|
|
|
|
d: -1 * sa - 15
|
|
|
|
});
|
2018-08-06 16:19:12 +02:00
|
|
|
}
|
|
|
|
return part;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default sleeve;
|