1
0
Fork 0

🚧 Benjamin WIP

This commit is contained in:
Joost De Cock 2019-07-08 11:54:47 +02:00
parent 7542e2f6b9
commit f96ccc95e7
3 changed files with 328 additions and 311 deletions

View file

@ -17,27 +17,38 @@ export default {
dependencies: {},
inject: {},
hide: [],
parts: ["front"],
parts: ["base"],
options: {
transitionLength: 0.7, // 70% of bandLength
bandLength: {
pct: 17,
min: 15,
max: 20
},
ribbonWidth: {
pct: 6,
min: 4,
max: 8
},
tipWidth: {
mm: 65,
min: 24,
max: 80
pct: 15,
min: 5,
max: 20
},
knotWidth: {
mm: 30,
min: 24,
max: 40
pct: 7,
min: 6,
max: 9
},
bowLength: {
mm: 120,
min: 100,
max: 140
pct: 28,
min: 23,
max: 33
},
collarEase: {
mm: 15,
pct: 3,
min: 0,
max: 15
max: 6
},
bowStyle: {
dflt: "butterfly",
@ -47,9 +58,6 @@ export default {
dflt: "straight",
list: ["straight", "pointed", "rounded"]
},
adjustmentRibbon: {
dflt: "0",
list: ["0", "1"]
}
adjustmentRibbon: { bool: false }
}
};

View file

@ -24,75 +24,84 @@ export default function(part) {
macro
} = part.shorthand();
// Remove from here
//options.bowStyle = 'butterfly';
//options.bowStyle = 'square';
//options.bowStyle = 'widesquare';
//options.bowStyle = 'diamond';
//options.endStyle = 'straight' ;
//options.endStyle = 'rounded' ;
//options.endStyle = 'pointed' ;
if (options.bowStyle === "square") options.tipWidth = options.knotWidth;
//final = true;
//paperless = true;
//sa = 10;
// Remove to here
for (let option of [
"ribbonWidth",
"bandLength",
"tipWidth",
"knotWidth",
"bowLength",
"collarEase"
])
store.set(option, measurements.neckCircumference * options[option]);
if (options.bowStyle == "square") options.tipWidth = options.knotWidth;
// For easy access
const knot = store.get("knotWidth");
const ribbon = store.get("ribbonWidth");
const tip = store.get("tipWidth");
const band = store.get("bandLength");
const transition = band * options.transitionLength;
const bow = store.get("bowLength");
let backWidth = 24;
let bandLength = 70;
let transitionLength = 50;
let halfBackWidth = backWidth / 2;
let halfTipWidth = options.tipWidth / 2;
let halfBowLength = options.bowLength / 2;
let halfKnotWidth = options.knotWidth / 2;
// Points
points.bandTopLeft = new Point(0, ribbon / -2);
points.bandBottomLeft = points.bandTopLeft.flipY();
points.bandTopRight = points.bandTopLeft.shift(0, band);
points.bandBottomRight = points.bandTopRight.flipY();
console.log(options.bowStyle);
console.log(options.knotWidth);
points.transitionTopRight = new Point(band + transition, knot / -2);
points.transitionBottomRight = points.transitionTopRight.flipY();
points.tip1Top = new Point(band + transition + 0.5 * bow, tip / -2);
points.tip1Bottom = points.tip1Top.flipY();
points.tip2Top = new Point(band + transition + 1.5 * bow, tip / -2);
points.tip2Bottom = points.tip2Top.flipY();
points.knotTop = new Point(band + transition + bow, knot / -2);
points.knotBottom = points.knotTop.flipY();
if (options.endStyle === "pointed" || options.endStyle === "rounded") {
points.tip = new Point(points.tip2Bottom.x + points.tip2Bottom.y, 0);
} else points.tip = new Point(points.tip2Bottom.x, 0);
if (options.bowStyle === "diamond" || options.bowStyle === "butterfly") {
const cpl = options.bowStyle === "diamond" ? bow / 10 : bow / 4;
points.transitionBottomRightCp1 = points.bandBottomRight.shiftOutwards(
points.transitionBottomRight,
cpl
);
points.transitionTopRightCp2 = points.transitionBottomRightCp1.flipY();
points.tip1TopCp2 = points.tip1Top.shift(180, cpl);
points.tip1TopCp1 = points.tip1Top.shift(0, cpl);
points.tip1BottomCp1 = points.tip1Bottom.shift(180, cpl);
points.tip1BottomCp2 = points.tip1Bottom.shift(0, cpl);
points.knotTopCp2 = points.knotTop.shift(180, cpl);
points.knotTopCp1 = points.knotTop.shift(0, cpl);
points.knotBottomCp2 = points.knotBottom.shift(0, cpl);
points.knotBottomCp1 = points.knotBottom.shift(180, cpl);
points.tip2TopCp2 = points.tip2Top.shift(180, cpl);
points.tip2BottomCp1 = points.tip2Bottom.shift(180, cpl);
}
paths.test = new Path()
.move(points.bandTopLeft)
.line(points.bandTopRight)
.line(points.transitionTopRight)
.line(points.tip2Top)
.line(points.tip)
.line(points.tip2Bottom)
.line(points.transitionBottomRight)
.line(points.bandBottomRight)
.line(points.bandBottomLeft)
.line(points.bandTopLeft)
.close();
return part;
let butterfly =
options.bowStyle == "butterfly" || options.bowStyle == "diamond";
let tipAdjustment = 0;
switch (options.endStyle) {
case "pointed":
tipAdjustment = halfTipWidth / 1.3;
break;
case "rounded":
tipAdjustment = halfTipWidth;
break;
}
let hhbl /*halfHalfBowLength */ = halfBowLength / 2;
let bcAdjust = options.bowStyle == "diamond" ? 10 : hhbl - 5;
let tieStart = new Path();
let tieLowKnot = new Path();
let tieTip = new Path();
let tieTopKnot = new Path();
let tieEnd = new Path();
points.Origin = new Point(0, 0);
points.LowBandEdge = points.Origin.shift(-90, halfBackWidth);
points.LowKnotEdge = points.Origin.shift(-90, halfKnotWidth);
points.LowTipEdge = points.Origin.shift(-90, halfTipWidth);
points.LowBandStart = points.LowBandEdge.clone();
points.LowBandEnd = points.LowBandEdge.shift(0, bandLength);
points.LowTransitionEnd = points.LowKnotEdge.shift(
0,
bandLength + transitionLength
);
console.log(points["LowBandEdge"].x);
tieStart
.move(points.Origin)
.line(points.LowBandStart)
.line(points.LowBandEnd)
.line(points.LowTransitionEnd);
//const bcAdjust = options.bowStyle == "diamond" ? 10 : hhbl - 5;
points.LowTip = points.LowTipEdge.shift(
0,

View file

@ -2,12 +2,12 @@ import freesewing from "@freesewing/core";
import plugins from "@freesewing/plugin-bundle";
import config from "../config";
// Parts
import draftFront from "./front";
import draftBase from "./base";
// Create new design
const benjamin = new freesewing.Design(config, plugins);
// Attach draft methods to prototype
benjamin.prototype.draftFront = draftFront;
benjamin.prototype.draftBase = draftBase;
export default benjamin;