2018-08-03 17:44:55 +02:00
|
|
|
import freesewing from "freesewing";
|
|
|
|
import base from "./base";
|
|
|
|
|
|
|
|
var front = {
|
2018-08-05 15:53:09 +02:00
|
|
|
draft: function(pattern) {
|
2018-08-05 18:34:32 +02:00
|
|
|
let part = new pattern.Part().copy(pattern.parts.back);
|
2018-08-05 15:53:09 +02:00
|
|
|
|
2018-08-03 17:44:55 +02:00
|
|
|
// prettier-ignore
|
2018-08-06 07:48:37 +02:00
|
|
|
let {sa, Point, points, Path, paths, Snippet, snippets, options, measurements, final, paperless, macro} = freesewing.utils.shorthand(part);
|
2018-08-05 15:53:09 +02:00
|
|
|
|
2018-08-06 07:48:37 +02:00
|
|
|
// Cut arm a bit deeper at the front
|
2018-08-05 15:53:09 +02:00
|
|
|
let deeper = measurements.chestCircumference * options.frontArmholeDeeper;
|
|
|
|
points.armholeHollowCp2.x -= deeper;
|
|
|
|
points.armholePitch.x -= deeper;
|
|
|
|
points.armholePitchCp1.x -= deeper;
|
|
|
|
|
2018-08-06 07:48:37 +02:00
|
|
|
// Rename cb (center back) to cf (center front)
|
|
|
|
for (let key of ["Neck", "Shoulder", "Armhole", "Waist", "Hips"]) {
|
|
|
|
console.log("key is", key);
|
|
|
|
points[`cf${key}`] = new Point(
|
|
|
|
points[`cb${key}`].x,
|
|
|
|
points[`cb${key}`].y
|
|
|
|
);
|
|
|
|
delete points[`cb${key}`];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Adapt neck opening
|
|
|
|
points.cfNeck = points.cfNeck.shift(-90, points.neck.x);
|
|
|
|
points.neckCp2 = points.cfNeck.shift(0, points.neck.x * 0.7);
|
|
|
|
|
2018-08-05 18:34:32 +02:00
|
|
|
paths.seam = new Path()
|
2018-08-06 07:48:37 +02:00
|
|
|
.move(points.cfNeck)
|
|
|
|
.line(points.cfHips)
|
2018-08-05 15:53:09 +02:00
|
|
|
.line(points.hips)
|
|
|
|
.line(points.armhole)
|
|
|
|
.curve(points.armholeCp1, points.armholeCp2, points.armholeHollow)
|
|
|
|
.curve(
|
|
|
|
points.armholeHollowCp1,
|
|
|
|
points.armholeHollowCp2,
|
|
|
|
points.armholePitch
|
|
|
|
)
|
|
|
|
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder)
|
|
|
|
.line(points.neck)
|
2018-08-06 07:48:37 +02:00
|
|
|
.curve(points.neckCp1, points.neckCp2, points.cfNeck)
|
2018-08-05 15:53:09 +02:00
|
|
|
.close()
|
|
|
|
.attr("class", "fabric");
|
|
|
|
|
|
|
|
// Final?
|
|
|
|
if (final) {
|
|
|
|
macro("title", { at: points.title, nr: 1, title: "front" });
|
2018-08-05 18:34:32 +02:00
|
|
|
snippets.armholePitchNotch = new Snippet("notch", points.armholePitch);
|
2018-08-05 15:53:09 +02:00
|
|
|
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Paperless?
|
|
|
|
|
|
|
|
if (paperless) {
|
|
|
|
macro("pd", {
|
2018-08-05 18:34:32 +02:00
|
|
|
path: new Path()
|
2018-08-05 15:53:09 +02:00
|
|
|
.move(points.armhole)
|
|
|
|
.curve(points.armholeCp1, points.armholeCp2, points.armholeHollow)
|
|
|
|
.curve(
|
|
|
|
points.armholeHollowCp1,
|
|
|
|
points.armholeHollowCp2,
|
|
|
|
points.armholePitch
|
|
|
|
)
|
|
|
|
.curve(
|
|
|
|
points.armholePitchCp1,
|
|
|
|
points.armholePitchCp2,
|
|
|
|
points.shoulder
|
|
|
|
),
|
|
|
|
d: sa + 15
|
|
|
|
});
|
|
|
|
macro("pd", {
|
2018-08-05 18:34:32 +02:00
|
|
|
path: new Path()
|
2018-08-05 15:53:09 +02:00
|
|
|
.move(points.armholePitch)
|
|
|
|
.curve(
|
|
|
|
points.armholePitchCp1,
|
|
|
|
points.armholePitchCp2,
|
|
|
|
points.shoulder
|
|
|
|
),
|
|
|
|
d: -15
|
|
|
|
});
|
|
|
|
}
|
2018-08-03 17:44:55 +02:00
|
|
|
|
|
|
|
return part;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default front;
|