1
0
Fork 0

sparkles: Added buttonhole placket

This commit is contained in:
Joost De Cock 2018-12-23 13:57:40 +01:00
parent 415f7c483e
commit c5d12ff4bd
8 changed files with 214 additions and 34 deletions

View file

@ -24,7 +24,8 @@ export default {
front: "frontBase", front: "frontBase",
frontRight: "front", frontRight: "front",
frontLeft: "front", frontLeft: "front",
buttonPlacket: "front" buttonPlacket: "front",
buttonholePlacket: "front"
}, },
inject: { inject: {
frontBase: "base", frontBase: "base",
@ -33,7 +34,8 @@ export default {
front: "frontBase", front: "frontBase",
frontRight: "front", frontRight: "front",
frontLeft: "front", frontLeft: "front",
buttonPlacket: "front" buttonPlacket: "front",
buttonholePlacket: "front"
}, },
hide: ["base", "frontBase", "front", "backBase"], hide: ["base", "frontBase", "front", "backBase"],
options: { options: {

View file

@ -109,10 +109,10 @@ let settings1 = { ...settings };
pattern1.settings.options.lengthBonus = 0.1; pattern1.settings.options.lengthBonus = 0.1;
pattern1.settings.options.hemStyle = "slashed"; pattern1.settings.options.hemStyle = "slashed";
pattern1.settings.options.buttonholePlacketStyle = "classic"; pattern1.settings.options.buttonholePlacketStyle = "classic";
pattern1.settings.options.buttonPlacketType = "seperate"; pattern1.settings.options.buttonholePlacketType = "seperate";
pattern1.settings.options.collarEase = 0.1; pattern1.settings.options.collarEase = 0.1;
pattern1.settings.sa = 10; pattern1.settings.sa = 10;
pattern1.settings.only = ["frontLeft" ]; pattern1.settings.only = ["frontLeft", "buttonholePlacket" ];
pattern1.draft(); pattern1.draft();
console.log(pattern1); console.log(pattern1);
document.getElementById("svg1").innerHTML = pattern1.render(); document.getElementById("svg1").innerHTML = pattern1.render();

View file

@ -0,0 +1,165 @@
import { addButtonHoles } from "./shared";
export default part => {
// prettier-ignore
let {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand();
for (let id of Object.keys(part.paths)) delete part.paths[id];
let width = options.buttonholePlacketWidth;
let fold = options.buttonholePlacketFoldWidth;
points.topInnerEdge = utils.lineIntersectsCurve(
new Point(points.cfNeck.x + fold * 2, points.cfNeck.y + 20),
new Point(points.cfNeck.x + fold * 2, points.cfNeck.y - 20),
points.cfNeck,
points.cfNeckCp1,
points.neckCp2Front,
points.neck
);
points.bottomInnerEdge = new Point(points.topInnerEdge.x, points.cfHem.y);
points.placketCfNeck = points.cfNeck.shift(180, fold * 2);
points.placketTopInnerEdgeFold = points.placketCfNeck.shift(0, width / 2);
points.placketTopInnerEdgeOver = points.placketCfNeck.shift(
0,
width / 2 - fold
);
points.placketTopInnerEdgeUnder = points.placketCfNeck.shift(
0,
width / 2 + fold
);
points.placketTopOuterEdgeFold = points.placketCfNeck.shift(180, width / 2);
points.placketTopOuterEdgeOver = points.placketCfNeck.shift(
180,
width / 2 - fold
);
points.placketTopOuterEdgeUnder = points.placketCfNeck.shift(
180,
width / 2 + fold
);
points.placketCfHem = points.cfHem.shift(180, fold * 2);
points.placketBottomInnerEdgeFold = points.placketCfHem.shift(0, width / 2);
points.placketBottomInnerEdgeOver = points.placketCfHem.shift(
0,
width / 2 - fold
);
points.placketBottomInnerEdgeUnder = points.placketCfHem.shift(
0,
width / 2 + fold
);
points.placketBottomOuterEdgeFold = points.placketCfHem.shift(180, width / 2);
points.placketBottomOuterEdgeOver = points.placketCfHem.shift(
180,
width / 2 - fold
);
points.placketBottomOuterEdgeUnder = points.placketCfHem.shift(
180,
width / 2 + fold
);
points.placketTopEdge = points.placketTopOuterEdgeFold.shift(180, width);
points.placketBottomEdge = points.placketBottomOuterEdgeFold.shift(
180,
width
);
paths.saBase = new Path()
.move(points.placketTopEdge)
.line(points.cfNeck)
.curve(points.cfNeckCp1, points.neckCp2Front, points.neck)
.split(points.topInnerEdge)[0]
.line(points.bottomInnerEdge);
paths.seam = paths.saBase
.clone()
.line(points.placketBottomEdge)
.close()
.attr("class", "fabric");
// Complete pattern?
if (complete) {
// Placket help lines
paths.frontCenter = new Path()
.move(points.placketCfNeck)
.line(points.placketCfHem)
.attr("class", "help");
paths.placketInnerEdgeFold = new Path()
.move(points.placketTopInnerEdgeFold)
.line(points.placketBottomInnerEdgeFold)
.attr("class", "dotted");
paths.placketInnerEdgeOver = new Path()
.move(points.placketTopInnerEdgeOver)
.line(points.placketBottomInnerEdgeOver)
.attr("class", "dotted");
paths.placketOuterEdgeFold = new Path()
.move(points.placketTopOuterEdgeFold)
.line(points.placketBottomOuterEdgeFold)
.attr("class", "dotted");
paths.placketOuterEdgeOver = new Path()
.move(points.placketTopOuterEdgeOver)
.line(points.placketBottomOuterEdgeOver)
.attr("class", "dotted");
paths.placketOuterEdgeUnder = new Path()
.move(points.placketTopOuterEdgeUnder)
.line(points.placketBottomOuterEdgeUnder)
.attr("class", "dotted");
// Notches
snippets["cfArmhole-notch"].anchor.x = points.cfArmhole.x - fold * 2;
snippets["cfWaist-notch"].anchor.x = points.cfArmhole.x - fold * 2;
snippets["cfHips-notch"].anchor.x = points.cfArmhole.x - fold * 2;
// Buttons
addButtonHoles(part, "placketCfNeck");
// Grainline
points.grainlineFrom = points.placketBottomEdge.shift(0, width / 2);
points.grainlineTo = points.placketTopEdge.shift(0, width / 2);
macro("grainline", {
from: points.grainlineFrom,
to: points.grainlineTo
});
// Title
points.title = new Point(points.placketCfNeck.x, points.cfArmhole.y);
macro("title", {
at: points.title,
nr: "2b",
title: "buttonholePlacket",
scale: 0.75,
rotation: -90
});
// Logo
points.logo = points.title.shift(-90, 120);
snippets.logo = new Snippet("logo", points.logo)
.attr("data-scale", 0.5)
.attr("data-rotate", -90);
if (sa) {
paths.sa = paths.saBase.offset(sa * -1);
paths.sa
.line(
new Point(
points.bottomInnerEdge.x + sa,
points.bottomInnerEdge.y + 3 * sa
)
)
.line(
new Point(
points.placketBottomEdge.x,
points.placketBottomEdge.y + 3 * sa
)
)
.line(points.placketBottomEdge)
.move(points.placketTopEdge)
.line(paths.sa.start())
.attr("class", "fabric sa");
}
}
// Paperless?
if (paperless) {
}
return part;
};

View file

@ -107,7 +107,7 @@ export default part => {
}); });
// Buttons // Buttons
addButtonHoles(part); addButtonHoles(part, "placketCfNeck");
// Title // Title
macro("title", { at: points.title, nr: 2, title: "frontLeft" }); macro("title", { at: points.title, nr: 2, title: "frontLeft" });

View file

@ -1,32 +1,41 @@
import { addButtonHoles } from "./shared";
export default part => { export default part => {
// prettier-ignore // prettier-ignore
let {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand(); let {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand();
let width = options.buttonPlacketWidth; let fold = options.buttonholePlacketFoldWidth;
points.placketTopIn = utils.lineIntersectsCurve( points.neckEdge = utils.lineIntersectsCurve(
new Point(width / -2, points.cfNeck.y + 20), new Point(points.cfNeck.x + fold * 2, points.cfNeck.y + 20),
new Point(width / -2, points.cfNeck.y - 20), new Point(points.cfNeck.x + fold * 2, points.cfNeck.y - 20),
points.cfNeck, points.cfNeck,
points.cfNeckCp1, points.cfNeckCp1,
points.neckCp2Front, points.neckCp2Front,
points.neck points.neck
); );
points.placketBottomIn = points.cfHem.shift(180, width / 2); points.hemEdge = new Point(points.neckEdge.x, points.cfHem.y);
paths.seam = paths.seam.split(points.placketTopIn)[0];
paths.seam.ops[0].to = points.placketBottomIn; paths.seam = paths.seam.split(points.neckEdge)[0];
paths.seam.ops[0].to = points.hemEdge;
paths.seam.close().attr("class", "fabric"); paths.seam.close().attr("class", "fabric");
// Complete pattern? // Complete pattern?
if (complete) { if (complete) {
// Title // Title
macro("title", { at: points.title, nr: "1a", title: "rightFront" }); macro("title", { at: points.title, nr: "2a", title: "frontLeft" });
if (sa) paths.saFromArmhole.line(paths.hemSa.start()); if (sa) {
paths.saFromArmhole.end().x = points.neckEdge.x - sa;
paths.hemSa.start().x = points.neckEdge.x - sa;
paths.saClosure = new Path()
.move(paths.saFromArmhole.end())
.line(paths.hemSa.start())
.attr("class", "fabric sa");
}
} }
// Paperless? // Paperless?
if (paperless) { if (paperless) {
} }
return part; return part;
}; };

View file

@ -1,20 +1,23 @@
import { addButtons } from "./shared"; import { addButtonHoles } from "./shared";
export default part => { export default part => {
// prettier-ignore // prettier-ignore
let {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand(); let {store, measurements, utils, sa, Point, points, Path, paths, Snippet, snippets, complete, paperless, macro, options} = part.shorthand();
let width = options.buttonPlacketWidth; console.log("seamless buttonjholes");
points.placketTopFold1 = points.cfNeck.shift(0, width / 2); let fold = options.buttonholePlacketFoldWidth;
points.placketTopFold2 = points.cfNeck.shift(0, width * 1.5); let width = options.buttonholePlacketWidth;
points.placketTopEdge = points.cfNeck.shift(0, width * 2.5); points.placketCfNeck = points.cfNeck;
points.placketBottomFold1 = points.cfHem.shift(0, width / 2); points.placketTopFold1 = points.cfNeck.shift(180, width / 2);
points.placketBottomFold2 = points.cfHem.shift(0, width * 1.5); points.placketTopFold2 = points.cfNeck.shift(180, width * 1.5);
points.placketBottomEdge = points.cfHem.shift(0, width * 2.5); points.placketTopEdge = points.cfNeck.shift(180, width * 2.5);
points.placketBottomFold1 = points.cfHem.shift(180, width / 2);
points.placketBottomFold2 = points.cfHem.shift(180, width * 1.5);
points.placketBottomEdge = points.cfHem.shift(180, width * 2.5);
paths.seam paths.seam
.line(points.placketTopEdge) .line(points.placketTopEdge)
.line(points.placketBottomEdge) .line(points.placketBottomEdge)
.line(points.cfHem)
.close(); .close();
// Complete pattern? // Complete pattern?
@ -35,27 +38,27 @@ export default part => {
macro("sprinkle", { macro("sprinkle", {
snippet: "notch", snippet: "notch",
on: [ on: [
"cfNeck",
"cfHem",
"placketTopFold1", "placketTopFold1",
"placketTopFold2", "placketTopFold2",
"placketBottomFold1", "placketBottomFold1",
"placketBottomFold2", "placketBottomFold2"
"cfNeck",
"cfHem"
] ]
}); });
// Buttons // Buttons
addButtons(part); addButtonHoles(part, "cfNeck");
// Title // Title
macro("title", { at: points.title, nr: 1, title: "frontRight" }); macro("title", { at: points.title, nr: 2, title: "frontLeft" });
if (sa) { if (sa) {
paths.saFromArmhole paths.saFromArmhole
.line(new Point(points.placketTopEdge.x, points.placketTopEdge.y - sa)) .line(points.placketTopEdge.shift(90, sa))
.line(points.placketTopEdge) .line(points.placketTopEdge)
.move(points.placketBottomEdge) .move(points.placketBottomEdge)
.line(points.placketBottomEdge.shift(-90, sa * 3)) .line(points.placketBottomEdge.shift(-90, 3 * sa))
.line(paths.hemSa.start()); .line(paths.hemSa.start());
} }
} }
@ -63,6 +66,5 @@ export default part => {
// Paperless? // Paperless?
if (paperless) { if (paperless) {
} }
return part; return part;
}; };

View file

@ -10,6 +10,7 @@ import draftFront from "./front";
import draftFrontRight from "./frontright"; import draftFrontRight from "./frontright";
import draftButtonPlacket from "./buttonplacket"; import draftButtonPlacket from "./buttonplacket";
import draftFrontLeft from "./frontleft"; import draftFrontLeft from "./frontleft";
import draftButtonholePlacket from "./buttonholeplacket";
// Constructor // Constructor
const Simon = function(settings) { const Simon = function(settings) {
@ -41,6 +42,7 @@ Simon.prototype.draftFront = draftFront;
Simon.prototype.draftFrontRight = draftFrontRight; Simon.prototype.draftFrontRight = draftFrontRight;
Simon.prototype.draftButtonPlacket = draftButtonPlacket; Simon.prototype.draftButtonPlacket = draftButtonPlacket;
Simon.prototype.draftFrontLeft = draftFrontLeft; Simon.prototype.draftFrontLeft = draftFrontLeft;
Simon.prototype.draftButtonholePlacket = draftButtonholePlacket;
export default Simon; export default Simon;

View file

@ -37,5 +37,5 @@ export const addButtons = function(
); );
}; };
export const addButtonHoles = part => export const addButtonHoles = (part, origin) =>
addButtons(part, "placketCfNeck", "buttonhole"); addButtons(part, origin, "buttonhole");