1
0
Fork 0

construction: Working on shared code between parts

This commit is contained in:
Joost De Cock 2018-08-05 15:53:09 +02:00
parent 424367abba
commit aec0ac3798
4 changed files with 73 additions and 6 deletions

View file

@ -27,7 +27,7 @@ export default {
{ id: "sleeveLengthBonus", val: 0, min: -40, max: 80 }, { id: "sleeveLengthBonus", val: 0, min: -40, max: 80 },
// Percentages // Percentages
{ id: "frontArmholeDeeper", val: 1, type: "%" }, { id: "frontArmholeDeeper", val: 0.5, type: "%" },
{ id: "chestEase", val: 8, type: "%", min: -4, max: 20 }, { id: "chestEase", val: 8, type: "%", min: -4, max: 20 },
{ id: "collarEase", val: 3.5, type: "%", min: 0, max: 10 }, { id: "collarEase", val: 3.5, type: "%", min: 0, max: 10 },
{ id: "bicepsEase", val: 15, type: "%", min: 0, max: 100 }, { id: "bicepsEase", val: 15, type: "%", min: 0, max: 100 },

View file

@ -41,7 +41,7 @@ var back = {
points.armholePitch.x / 2, points.armholePitch.x / 2,
points.armholePitch.y points.armholePitch.y
); );
macro("title", { at: points.title, nr: 2 }); macro("title", { at: points.title, nr: 2, title: "back" });
points.logo = points.title.shift(-90, 100); points.logo = points.title.shift(-90, 100);
snippets.logo = new snippet("logo", points.logo); snippets.logo = new snippet("logo", points.logo);
@ -95,6 +95,7 @@ var back = {
}); });
macro("ld", { from: points.neck, to: points.shoulder, d: sa + 15 }); macro("ld", { from: points.neck, to: points.shoulder, d: sa + 15 });
macro("pd", { macro("pd", {
id: "armholeLengthDimension",
path: new path() path: new path()
.move(points.armhole) .move(points.armhole)
.curve(points.armholeCp1, points.armholeCp2, points.armholeHollow) .curve(points.armholeCp1, points.armholeCp2, points.armholeHollow)
@ -111,6 +112,7 @@ var back = {
d: sa + 15 d: sa + 15
}); });
macro("pd", { macro("pd", {
id: "armholePitchDimension",
path: new path() path: new path()
.move(points.armholePitch) .move(points.armholePitch)
.curve( .curve(

View file

@ -2,11 +2,75 @@ import freesewing from "freesewing";
import base from "./base"; import base from "./base";
var front = { var front = {
draft: function(part) { draft: function(pattern) {
// prettier-ignore let part = new pattern.part().copy(pattern.parts.back);
let {sa, point, points, path, paths, snippet, snippets, final, paperless, macro} = freesewing.utils.shorthand(part);
// prettier-ignore
let {sa, point, points, path, paths, snippet, snippets, options, measurements, final, paperless, macro} = freesewing.utils.shorthand(part);
let deeper = measurements.chestCircumference * options.frontArmholeDeeper;
points.armholeHollowCp2.x -= deeper;
points.armholePitch.x -= deeper;
points.armholePitchCp1.x -= deeper;
paths.seam = null;
paths.seam = new path()
.move(points.cbNeck)
.line(points.cbHips)
.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)
.curve(points.neckCp1, points.cbNeck, points.cbNeck)
.close()
.attr("class", "fabric");
// Final?
if (final) {
macro("title", { at: points.title, nr: 1, title: "front" });
snippets.armholePitchNotch = new snippet("notch", points.armholePitch);
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
}
// Paperless?
if (paperless) {
macro("pd", {
id: "armholeLengthDimension",
path: new path()
.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", {
id: "armholePitchDimension",
path: new path()
.move(points.armholePitch)
.curve(
points.armholePitchCp1,
points.armholePitchCp2,
points.shoulder
),
d: -15
});
}
macro("title", { at: points.title, nr: 1 });
return part; return part;
} }
}; };

View file

@ -18,6 +18,7 @@ var pattern = new freesewing.pattern({ version: version, ...config })
pattern.draft = function() { pattern.draft = function() {
pattern.parts.back = back.draft(pattern); pattern.parts.back = back.draft(pattern);
pattern.parts.front = front.draft(pattern);
// Clone back // Clone back
//pattern.parts.front = pattern.parts.back.clone(pattern.parts.front.id); //pattern.parts.front = pattern.parts.back.clone(pattern.parts.front.id);
// Draft front // Draft front