construction: Fitted sleevecap
This commit is contained in:
parent
8379361e47
commit
69f724faea
4 changed files with 187 additions and 178 deletions
|
@ -31,6 +31,7 @@ export default {
|
||||||
{ 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 },
|
||||||
|
{ id: "cuffEase", val: 20, type: "%", min: 0, max: 500 },
|
||||||
{ id: "backNeckCutout", val: 5, type: "%", min: 2, max: 8 },
|
{ id: "backNeckCutout", val: 5, type: "%", min: 2, max: 8 },
|
||||||
{ id: "acrossBackFactor", val: 97, type: "%", min: 93, max: 100 },
|
{ id: "acrossBackFactor", val: 97, type: "%", min: 93, max: 100 },
|
||||||
{ id: "armholeDepthFactor", val: 50, type: "%", min: 35, max: 65 },
|
{ id: "armholeDepthFactor", val: 50, type: "%", min: 35, max: 65 },
|
||||||
|
@ -46,12 +47,10 @@ export default {
|
||||||
{ id: "sleevecapQ1Spread1", val: 6, type: "%", min: 0, max: 7 },
|
{ id: "sleevecapQ1Spread1", val: 6, type: "%", min: 0, max: 7 },
|
||||||
{ id: "sleevecapQ1Spread2", val: 15, type: "%", min: 0, max: 7 },
|
{ id: "sleevecapQ1Spread2", val: 15, type: "%", min: 0, max: 7 },
|
||||||
{ id: "sleevecapQ2Spread1", val: 15, type: "%", min: 0, max: 7 },
|
{ id: "sleevecapQ2Spread1", val: 15, type: "%", min: 0, max: 7 },
|
||||||
{ id: "sleevecapQ2Spread2", val: 5, type: "%", min: 0, max: 7 },
|
{ id: "sleevecapQ2Spread2", val: 10, type: "%", min: 0, max: 7 },
|
||||||
{ id: "sleevecapQ3Spread1", val: 5, type: "%", min: 0, max: 7 },
|
{ id: "sleevecapQ3Spread1", val: 10, type: "%", min: 0, max: 7 },
|
||||||
{ id: "sleevecapQ3Spread2", val: 8, type: "%", min: 0, max: 7 },
|
{ id: "sleevecapQ3Spread2", val: 8, type: "%", min: 0, max: 7 },
|
||||||
{ id: "sleevecapQ4Spread1", val: 7, type: "%", min: 0, max: 7 },
|
{ id: "sleevecapQ4Spread1", val: 7, type: "%", min: 0, max: 7 },
|
||||||
{ id: "sleevecapQ4Spread2", val: 7, type: "%", min: 0, max: 7 },
|
{ id: "sleevecapQ4Spread2", val: 7, type: "%", min: 0, max: 7 },
|
||||||
{ id: "sleevecapTopSpread1", val: 5, type: "%", min: 0, max: 7 },
|
|
||||||
{ id: "sleevecapTopSpread2", val: 5, type: "%", min: 0, max: 7 },
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,10 +15,20 @@
|
||||||
<script type="text/javascript" src="tmp/theme.js"></script>
|
<script type="text/javascript" src="tmp/theme.js"></script>
|
||||||
<script type="text/javascript" src="tmp/designer.js"></script>
|
<script type="text/javascript" src="tmp/designer.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
var debug = {
|
||||||
|
name: 'debug',
|
||||||
|
hooks: {
|
||||||
|
debug: function debugPlugin(next, data) {
|
||||||
|
if(typeof data === 'string') console.log('%cDebug', 'color: #dd69dd', data);
|
||||||
|
else console.log(data);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
var pattern = freesewing.patterns.brian
|
var pattern = freesewing.patterns.brian
|
||||||
|
.with(debug)
|
||||||
.with(freesewing.plugins.theme)
|
.with(freesewing.plugins.theme)
|
||||||
.with(freesewing.plugins.designer);
|
.with(freesewing.plugins.designer)
|
||||||
|
|
||||||
pattern.settings.measurements = {
|
pattern.settings.measurements = {
|
||||||
bicepsCircumference: 335,
|
bicepsCircumference: 335,
|
||||||
centerBackNeckToWaist: 480,
|
centerBackNeckToWaist: 480,
|
||||||
|
@ -31,28 +41,14 @@
|
||||||
shoulderToWrist: 700,
|
shoulderToWrist: 700,
|
||||||
wristCircumference: 190
|
wristCircumference: 190
|
||||||
};
|
};
|
||||||
//pattern.options.sleevecapQ1Offset = 0.05;
|
|
||||||
//pattern.options.sleevecapQ2Offset = 0.055;
|
|
||||||
//pattern.options.sleevecapQ3Offset = 0.045;
|
|
||||||
//pattern.options.sleevecapQ4Offset = 0.02;
|
|
||||||
//pattern.options.sleevecapQ1Spread1 = 0.06;
|
|
||||||
//pattern.options.sleevecapQ1Spread2 = 0.15;
|
|
||||||
//pattern.options.sleevecapQ2Spread1 = 0.15;
|
|
||||||
//pattern.options.sleevecapQ2Spread2 = 0.05;
|
|
||||||
//pattern.options.sleevecapQ3Spread1 = 0.05;
|
|
||||||
//pattern.options.sleevecapQ3Spread2 = 0.08;
|
|
||||||
//pattern.options.sleevecapQ4Spread1 = 0.07;
|
|
||||||
//pattern.options.sleevecapQ4Spread2 = 0.07;
|
|
||||||
//pattern.options.sleevecapTopSpread1 = 0.05;
|
|
||||||
//pattern.options.sleevecapTopSpread2 = 0.05;
|
|
||||||
pattern.settings.mode = 'draft';
|
pattern.settings.mode = 'draft';
|
||||||
pattern.settings.paperless = true;
|
pattern.settings.paperless = true;
|
||||||
//pattern.settings.sa = 10;
|
pattern.settings.sa = 10;
|
||||||
pattern.settings.units = 'metric';
|
pattern.settings.units = 'metric';
|
||||||
pattern.draft();
|
pattern.draft();
|
||||||
document.getElementById("svg").innerHTML = pattern.render();
|
document.getElementById("svg").innerHTML = pattern.render();
|
||||||
|
|
||||||
console.log('Freesewing object',freesewing);
|
|
||||||
function pointHover(evt) {
|
function pointHover(evt) {
|
||||||
var point = evt.target;
|
var point = evt.target;
|
||||||
var id = point.id;
|
var id = point.id;
|
||||||
|
|
|
@ -23,7 +23,6 @@ pattern.draft = function() {
|
||||||
pattern.parts.back = back.draft(pattern);
|
pattern.parts.back = back.draft(pattern);
|
||||||
pattern.parts.front = front.draft(pattern);
|
pattern.parts.front = front.draft(pattern);
|
||||||
pattern.parts.sleeve = sleeve.draft(pattern);
|
pattern.parts.sleeve = sleeve.draft(pattern);
|
||||||
|
|
||||||
return pattern;
|
return pattern;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,26 @@
|
||||||
import freesewing from "freesewing";
|
import freesewing from "freesewing";
|
||||||
|
|
||||||
var sleeve = {
|
function sleevecapDelta(store) {
|
||||||
draft: function(pattern) {
|
// Positive values mean sleevecap is longer than armhole
|
||||||
let part = new pattern.Part();
|
return (
|
||||||
|
store.get("sleevecapLength") -
|
||||||
|
(store.get("frontArmholeLength") + store.get("backArmholeLength"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sleevecapAdjust(store) {
|
||||||
|
let delta = sleevecapDelta(store);
|
||||||
|
let factor = store.get("sleeveFactor");
|
||||||
|
if (delta > 50) factor = factor * 0.95;
|
||||||
|
else if (delta > 0) factor = factor * 0.995;
|
||||||
|
else if (delta < 50) factor = factor * 1.05;
|
||||||
|
else factor = factor * 1.005;
|
||||||
|
store.set("sleeveFactor", factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
function draftSleevecap(part) {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
let {store, sa, measurements, options, Point, points, Path, paths, Snippet, snippets, final, paperless, macro} = freesewing.utils.shorthand(part);
|
let {debug, store, measurements, options, Point, points, Path, paths} = freesewing.utils.shorthand(part);
|
||||||
|
|
||||||
store.set("sleeveFactor", 1);
|
|
||||||
|
|
||||||
// Sleeve center axis
|
// Sleeve center axis
|
||||||
points.centerCap = new Point(0, 0);
|
points.centerCap = new Point(0, 0);
|
||||||
points.centerWrist = new Point(
|
points.centerWrist = new Point(
|
||||||
|
@ -18,18 +30,21 @@ var sleeve = {
|
||||||
points.centerBiceps = new Point(
|
points.centerBiceps = new Point(
|
||||||
0,
|
0,
|
||||||
points.centerWrist.y -
|
points.centerWrist.y -
|
||||||
measurements.bicepsCircumference *
|
(measurements.bicepsCircumference * (1 + options.sleevecapHeightFactor)) /
|
||||||
(1 + options.sleevecapHeightFactor) *
|
|
||||||
store.get("sleeveFactor")
|
store.get("sleeveFactor")
|
||||||
);
|
);
|
||||||
|
|
||||||
// Sleeve half width, limit impact of sleeveTweakFactor to 25% to avoid a too narrow sleeve
|
// Left and right biceps points
|
||||||
let halfWidth =
|
|
||||||
(measurements.bicepsCircumference * (1 + options.bicepsEase)) / 2;
|
|
||||||
points.leftBiceps = points.centerBiceps.shift(
|
points.leftBiceps = points.centerBiceps.shift(
|
||||||
180,
|
180,
|
||||||
halfWidth * 0.75 + halfWidth * 0.25 * store.get("sleeveFactor")
|
((measurements.bicepsCircumference * (1 + options.bicepsEase)) / 2) *
|
||||||
|
store.get("sleeveFactor")
|
||||||
);
|
);
|
||||||
|
// Make sure we draft a sleeve that fits the biceps
|
||||||
|
if (points.leftBiceps.x * -1 < measurements.bicepsCircumference / 1.95) {
|
||||||
|
points.leftBiceps.x = measurements.bicepsCircumference / 1.95;
|
||||||
|
part.debug("Warning: Forced sleeve to fit biceps");
|
||||||
|
}
|
||||||
points.rightBiceps = points.leftBiceps.flipX(points.centerBiceps);
|
points.rightBiceps = points.leftBiceps.flipX(points.centerBiceps);
|
||||||
|
|
||||||
// Pitch points
|
// Pitch points
|
||||||
|
@ -61,8 +76,7 @@ var sleeve = {
|
||||||
0.5
|
0.5
|
||||||
);
|
);
|
||||||
// Offset points
|
// Offset points
|
||||||
let baseOffset =
|
let baseOffset = measurements.bicepsCircumference * (1 + options.bicepsEase);
|
||||||
measurements.bicepsCircumference * (1 + options.bicepsEase);
|
|
||||||
points.capQ1 = points.capQ1Base.shift(
|
points.capQ1 = points.capQ1Base.shift(
|
||||||
points.rightBiceps.angle(points.frontPitch) + 90,
|
points.rightBiceps.angle(points.frontPitch) + 90,
|
||||||
baseOffset * options.sleevecapQ1Offset
|
baseOffset * options.sleevecapQ1Offset
|
||||||
|
@ -112,61 +126,63 @@ var sleeve = {
|
||||||
points.leftBiceps.angle(points.backPitch),
|
points.leftBiceps.angle(points.backPitch),
|
||||||
baseOffset * options.sleevecapQ4Spread2 * -1
|
baseOffset * options.sleevecapQ4Spread2 * -1
|
||||||
);
|
);
|
||||||
// Center cap control points
|
|
||||||
points.centerCapCp1 = points.centerCap.shift(
|
|
||||||
points.capQ3.angle(points.capQ2),
|
|
||||||
baseOffset * options.sleevecapTopSpread1
|
|
||||||
);
|
|
||||||
points.centerCapCp2 = points.centerCap.shift(
|
|
||||||
points.capQ3.angle(points.capQ2),
|
|
||||||
baseOffset * options.sleevecapTopSpread2 * -1
|
|
||||||
);
|
|
||||||
|
|
||||||
paths.test = new Path()
|
// Wrist
|
||||||
.move(points.centerWrist)
|
points.wristRight = points.centerWrist.shift(
|
||||||
.line(points.centerCap)
|
0,
|
||||||
.move(points.leftBiceps)
|
(measurements.wristCircumference * (1 + options.cuffEase)) / 2
|
||||||
.line(points.rightBiceps)
|
);
|
||||||
|
points.wristLeft = points.wristRight.rotate(180, points.centerWrist);
|
||||||
|
|
||||||
|
// Seamline
|
||||||
|
let sleevecap = new Path()
|
||||||
|
.move(points.rightBiceps)
|
||||||
.curve(points.rightBiceps, points.capQ1Cp1, points.capQ1)
|
.curve(points.rightBiceps, points.capQ1Cp1, points.capQ1)
|
||||||
.curve(points.capQ1Cp2, points.capQ2Cp1, points.capQ2)
|
.curve(points.capQ1Cp2, points.capQ2Cp1, points.capQ2)
|
||||||
.curve(points.capQ2Cp2, points.centerCapCp1, points.centerCap)
|
.curve(points.capQ2Cp2, points.capQ3Cp1, points.capQ3)
|
||||||
.curve(points.centerCapCp2, points.capQ3Cp1, points.capQ3)
|
|
||||||
.curve(points.capQ3Cp2, points.capQ4Cp1, points.capQ4)
|
.curve(points.capQ3Cp2, points.capQ4Cp1, points.capQ4)
|
||||||
.curve(points.capQ4Cp2, points.leftBiceps, points.leftBiceps);
|
.curve(points.capQ4Cp2, points.leftBiceps, points.leftBiceps);
|
||||||
//// Wrist
|
|
||||||
//$wristWidth = $model->getMeasurement('wristCircumference') + $this->getOption('cuffEase');
|
paths.seam = new Path()
|
||||||
//$p->newPoint(31, $wristWidth / -2, $p->y(3), 'Wrist point back');
|
.move(points.leftBiceps)
|
||||||
//$p->newPoint(32, $wristWidth / 2, $p->y(3), 'Wrist point front');
|
.move(points.wristLeft)
|
||||||
//// Elbow location
|
.move(points.wristRight)
|
||||||
//$p->newPoint(33, 0, $p->y(2) + $p->distance(2, 3) / 2 - 25, 'Elbow point');
|
.line(points.rightBiceps)
|
||||||
//$p->addPoint('.help1', $p->shift(33, 0, 10));
|
.join(sleevecap, true);
|
||||||
//$p->addPoint(34, $p->beamsCross(-5, 31, 33, '.help1'), 'Elbow point back side');
|
|
||||||
//$p->addPoint(35, $p->beamsCross(5, 32, 33, 34), 'Elbow point front side');
|
// Store sleevecap length
|
||||||
//$path = 'M 31 L -5 C -5 20 16 C 21 10 10 C 10 22 17 C 23 28 30 C 29 25 18 C 24 11 11 C 11 27 19 C 26 5 5 L 32 z';
|
store.set("sleevecapLength", sleevecap.length());
|
||||||
//$p->newPath('seamline', $path, ['class' => 'fabric']);
|
}
|
||||||
//// Mark path for sample service
|
|
||||||
//$p->paths['seamline']->setSample(true);
|
var sleeve = {
|
||||||
//
|
draft: function(pattern) {
|
||||||
//// Store sleevehead length
|
let part = new pattern.Part();
|
||||||
//$this->setValue('sleeveheadLength',
|
|
||||||
// $p->curveLen(-5,-5,20,16) +
|
// prettier-ignore
|
||||||
// $p->curveLen(16,21,10,10) +
|
let {debug, store, sa, measurements, options, Point, points, Path, paths, Snippet, snippets, final, paperless, macro} = freesewing.utils.shorthand(part);
|
||||||
// $p->curveLen(10,10,22,17) +
|
|
||||||
// $p->curveLen(17,23,28,30) +
|
store.set("sleeveFactor", 1);
|
||||||
// $p->curveLen(30,29,25,18) +
|
let run = 1;
|
||||||
// $p->curveLen(18,24,11,11) +
|
do {
|
||||||
// $p->curveLen(11,11,27,19) +
|
draftSleevecap(part);
|
||||||
// $p->curveLen(19,26,5,5)
|
part.debug(
|
||||||
//);
|
`Sleevecap draft ${run}, sleevecap delta is ${sleevecapDelta(store)}`
|
||||||
|
);
|
||||||
|
sleevecapAdjust(store);
|
||||||
|
run++;
|
||||||
|
} while (Math.abs(sleevecapDelta(store)) > 2 && run < 10);
|
||||||
|
|
||||||
// Anchor point for sampling
|
// Anchor point for sampling
|
||||||
points.gridAnchor = points.origin;
|
points.gridAnchor = points.origin;
|
||||||
points.test = new Point(10, 10);
|
points.test = new Point(10, 10);
|
||||||
console.log(part);
|
|
||||||
|
|
||||||
// Final?
|
// Final?
|
||||||
if (final) {
|
if (final) {
|
||||||
//macro("title", { at: points.title, nr: 2, title: "back" });
|
points.title = points.centerBiceps.shiftFractionTowards(
|
||||||
|
points.centerWrist,
|
||||||
|
0.3
|
||||||
|
);
|
||||||
|
macro("title", { at: points.title, nr: 3, title: "sleeve" });
|
||||||
//snippets.armholePitchNotch = new Snippet("notch", points.armholePitch);
|
//snippets.armholePitchNotch = new Snippet("notch", points.armholePitch);
|
||||||
//if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
//if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
||||||
}
|
}
|
||||||
|
@ -175,7 +191,6 @@ var sleeve = {
|
||||||
if (paperless) {
|
if (paperless) {
|
||||||
//shared.dimensions(macro, points, Path, sa);
|
//shared.dimensions(macro, points, Path, sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue