🎨 Updated prettier config
This commit is contained in:
parent
b8e632998b
commit
6710d76b08
401 changed files with 13193 additions and 15620 deletions
|
@ -1,4 +1,4 @@
|
|||
import * as shared from "./shared";
|
||||
import * as shared from './shared'
|
||||
|
||||
export default part => {
|
||||
let {
|
||||
|
@ -12,67 +12,64 @@ export default part => {
|
|||
complete,
|
||||
paperless,
|
||||
macro
|
||||
} = part.shorthand();
|
||||
} = part.shorthand()
|
||||
|
||||
// Seamline
|
||||
paths.saBase = shared.saBase("back", points, Path);
|
||||
paths.saBase = shared.saBase('back', points, Path)
|
||||
paths.seam = new Path()
|
||||
.move(points.cbNeck)
|
||||
.line(points.cbHips)
|
||||
.join(paths.saBase)
|
||||
.attr("class", "fabric");
|
||||
.attr('class', 'fabric')
|
||||
|
||||
// Store lengths to fit sleeve
|
||||
store.set("backArmholeLength", shared.armholeLength(points, Path));
|
||||
store.set(
|
||||
"backShoulderToArmholePitch",
|
||||
shared.shoulderToArmholePitch(points, Path)
|
||||
);
|
||||
store.set('backArmholeLength', shared.armholeLength(points, Path))
|
||||
store.set('backShoulderToArmholePitch', shared.shoulderToArmholePitch(points, Path))
|
||||
|
||||
// Complete pattern?
|
||||
if (complete) {
|
||||
macro("cutonfold", {
|
||||
macro('cutonfold', {
|
||||
from: points.cbNeck,
|
||||
to: points.cbHips,
|
||||
grainline: true
|
||||
});
|
||||
})
|
||||
|
||||
macro("title", { at: points.title, nr: 2, title: "back" });
|
||||
snippets.armholePitchNotch = new Snippet("bnotch", points.armholePitch);
|
||||
macro('title', { at: points.title, nr: 2, title: 'back' })
|
||||
snippets.armholePitchNotch = new Snippet('bnotch', points.armholePitch)
|
||||
if (sa) {
|
||||
paths.sa = paths.saBase
|
||||
.offset(sa)
|
||||
.attr("class", "fabric sa")
|
||||
.attr('class', 'fabric sa')
|
||||
.line(points.cbNeck)
|
||||
.move(points.cbHips);
|
||||
paths.sa.line(paths.sa.start());
|
||||
.move(points.cbHips)
|
||||
paths.sa.line(paths.sa.start())
|
||||
}
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
shared.dimensions(macro, points, Path, sa);
|
||||
macro("hd", {
|
||||
shared.dimensions(macro, points, Path, sa)
|
||||
macro('hd', {
|
||||
from: points.cbHips,
|
||||
to: points.hips,
|
||||
y: points.hips.y + sa + 15
|
||||
});
|
||||
macro("vd", {
|
||||
})
|
||||
macro('vd', {
|
||||
from: points.cbHips,
|
||||
to: points.cbNeck,
|
||||
x: points.cbHips.x - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
})
|
||||
macro('hd', {
|
||||
from: points.cbNeck,
|
||||
to: points.neck,
|
||||
y: points.neck.y - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
})
|
||||
macro('hd', {
|
||||
from: points.cbNeck,
|
||||
to: points.shoulder,
|
||||
y: points.neck.y - sa - 30
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
return part;
|
||||
};
|
||||
return part
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as shared from "./shared";
|
||||
import * as shared from './shared'
|
||||
|
||||
export default part => {
|
||||
let {
|
||||
|
@ -15,179 +15,146 @@ export default part => {
|
|||
paths,
|
||||
utils,
|
||||
complete
|
||||
} = part.shorthand();
|
||||
} = part.shorthand()
|
||||
|
||||
store.set(
|
||||
"shoulderEase",
|
||||
(measurements.shoulderToShoulder * options.shoulderEase) / 2
|
||||
);
|
||||
store.set('shoulderEase', (measurements.shoulderToShoulder * options.shoulderEase) / 2)
|
||||
|
||||
// Center back (cb) vertical axis
|
||||
points.cbNeck = new Point(
|
||||
0,
|
||||
options.backNeckCutout * measurements.neckCircumference
|
||||
);
|
||||
points.cbNeck = new Point(0, options.backNeckCutout * measurements.neckCircumference)
|
||||
points.cbShoulder = new Point(
|
||||
0,
|
||||
(measurements.shoulderSlope -
|
||||
measurements.shoulderToShoulder * options.shoulderSlopeReduction) /
|
||||
2
|
||||
);
|
||||
)
|
||||
points.cbArmhole = new Point(
|
||||
0,
|
||||
points.cbShoulder.y +
|
||||
(measurements.shoulderToShoulder * options.shoulderSlopeReduction) / 2 +
|
||||
measurements.bicepsCircumference *
|
||||
(1 + options.bicepsEase) *
|
||||
options.armholeDepthFactor
|
||||
);
|
||||
points.cbWaist = new Point(
|
||||
0,
|
||||
points.cbNeck.y + measurements.centerBackNeckToWaist
|
||||
);
|
||||
points.cbHips = new Point(
|
||||
0,
|
||||
points.cbWaist.y + measurements.naturalWaistToHip
|
||||
);
|
||||
measurements.bicepsCircumference * (1 + options.bicepsEase) * options.armholeDepthFactor
|
||||
)
|
||||
points.cbWaist = new Point(0, points.cbNeck.y + measurements.centerBackNeckToWaist)
|
||||
points.cbHips = new Point(0, points.cbWaist.y + measurements.naturalWaistToHip)
|
||||
points.cbHem = new Point(
|
||||
0,
|
||||
points.cbWaist.y +
|
||||
measurements.naturalWaistToHip +
|
||||
(measurements.centerBackNeckToWaist + measurements.naturalWaistToHip) *
|
||||
options.lengthBonus
|
||||
);
|
||||
(measurements.centerBackNeckToWaist + measurements.naturalWaistToHip) * options.lengthBonus
|
||||
)
|
||||
|
||||
// Side back (cb) vertical axis
|
||||
points.armhole = new Point(
|
||||
(measurements.chestCircumference * (1 + options.chestEase)) / 4,
|
||||
points.cbArmhole.y
|
||||
);
|
||||
points.waist = new Point(points.armhole.x, points.cbWaist.y);
|
||||
points.hips = new Point(points.armhole.x, points.cbHips.y);
|
||||
points.hem = new Point(points.armhole.x, points.cbHem.y);
|
||||
)
|
||||
points.waist = new Point(points.armhole.x, points.cbWaist.y)
|
||||
points.hips = new Point(points.armhole.x, points.cbHips.y)
|
||||
points.hem = new Point(points.armhole.x, points.cbHem.y)
|
||||
|
||||
// Shoulder line
|
||||
points.neck = new Point(
|
||||
(measurements.neckCircumference * (1 + options.collarEase)) /
|
||||
options.collarFactor,
|
||||
(measurements.neckCircumference * (1 + options.collarEase)) / options.collarFactor,
|
||||
0
|
||||
);
|
||||
)
|
||||
points.shoulder = new Point(
|
||||
measurements.shoulderToShoulder / 2 + store.get("shoulderEase"),
|
||||
measurements.shoulderToShoulder / 2 + store.get('shoulderEase'),
|
||||
points.cbShoulder.y
|
||||
);
|
||||
)
|
||||
|
||||
// Armhhole
|
||||
points.armholePitch = new Point(
|
||||
(measurements.shoulderToShoulder * options.acrossBackFactor) / 2 +
|
||||
store.get("shoulderEase") / 2,
|
||||
store.get('shoulderEase') / 2,
|
||||
points.shoulder.y + points.shoulder.dy(points.armhole) / 2
|
||||
);
|
||||
points._tmp1 = new Point(points.armholePitch.x, points.armhole.y);
|
||||
points._tmp2 = points._tmp1.shift(45, 10);
|
||||
)
|
||||
points._tmp1 = new Point(points.armholePitch.x, points.armhole.y)
|
||||
points._tmp2 = points._tmp1.shift(45, 10)
|
||||
points._tmp3 = utils.beamsIntersect(
|
||||
points._tmp1,
|
||||
points._tmp2,
|
||||
points.armhole,
|
||||
points.armholePitch
|
||||
);
|
||||
points.armholeHollow = points._tmp1.shiftFractionTowards(points._tmp3, 0.5);
|
||||
points.armholeCp2 = points.armhole.shift(
|
||||
180,
|
||||
points._tmp1.dx(points.armhole) / 4
|
||||
);
|
||||
)
|
||||
points.armholeHollow = points._tmp1.shiftFractionTowards(points._tmp3, 0.5)
|
||||
points.armholeCp2 = points.armhole.shift(180, points._tmp1.dx(points.armhole) / 4)
|
||||
points.armholeHollowCp1 = points.armholeHollow.shift(
|
||||
-45,
|
||||
points.armholeHollow.dy(points.armhole) / 2
|
||||
);
|
||||
)
|
||||
points.armholeHollowCp2 = points.armholeHollow.shift(
|
||||
135,
|
||||
points.armholePitch.dx(points.armholeHollow)
|
||||
);
|
||||
)
|
||||
points.armholePitchCp1 = points.armholePitch.shift(
|
||||
-90,
|
||||
points.armholePitch.dy(points.armholeHollow) / 2
|
||||
);
|
||||
)
|
||||
points.armholePitchCp2 = points.armholePitch.shift(
|
||||
90,
|
||||
points.shoulder.dy(points.armholePitch) / 2
|
||||
);
|
||||
)
|
||||
points.shoulderCp1 = points.shoulder
|
||||
.shiftTowards(points.neck, points.shoulder.dy(points.armholePitch) / 5)
|
||||
.rotate(90, points.shoulder);
|
||||
.rotate(90, points.shoulder)
|
||||
|
||||
// Neck opening (back)
|
||||
points._tmp4 = points.neck
|
||||
.shiftTowards(points.shoulder, 10)
|
||||
.rotate(-90, points.neck);
|
||||
points.neckCp2 = utils.beamIntersectsY(
|
||||
points.neck,
|
||||
points._tmp4,
|
||||
points.cbNeck.y
|
||||
);
|
||||
points._tmp4 = points.neck.shiftTowards(points.shoulder, 10).rotate(-90, points.neck)
|
||||
points.neckCp2 = utils.beamIntersectsY(points.neck, points._tmp4, points.cbNeck.y)
|
||||
|
||||
// Fit collar
|
||||
points.cfNeck = points.neck.rotate(-90, new Point(0, 0));
|
||||
let target = measurements.neckCircumference * (1 + options.collarEase);
|
||||
let delta = 0;
|
||||
let run = 0;
|
||||
points.cfNeck = points.neck.rotate(-90, new Point(0, 0))
|
||||
let target = measurements.neckCircumference * (1 + options.collarEase)
|
||||
let delta = 0
|
||||
let run = 0
|
||||
do {
|
||||
run++;
|
||||
points.cfNeck = points.cfNeck.shift(90, delta / 3);
|
||||
run++
|
||||
points.cfNeck = points.cfNeck.shift(90, delta / 3)
|
||||
points.frontNeckCpEdge = utils.beamsIntersect(
|
||||
points.neck,
|
||||
points.neckCp2,
|
||||
points.cfNeck,
|
||||
new Point(20, points.cfNeck.y)
|
||||
);
|
||||
points.cfNeckCp1 = points.cfNeck.shiftFractionTowards(
|
||||
points.frontNeckCpEdge,
|
||||
0.55
|
||||
);
|
||||
points.neckCp2Front = points.neck.shiftFractionTowards(
|
||||
points.frontNeckCpEdge,
|
||||
0.65
|
||||
);
|
||||
)
|
||||
points.cfNeckCp1 = points.cfNeck.shiftFractionTowards(points.frontNeckCpEdge, 0.55)
|
||||
points.neckCp2Front = points.neck.shiftFractionTowards(points.frontNeckCpEdge, 0.65)
|
||||
paths.neckOpening = new Path()
|
||||
.move(points.cfNeck)
|
||||
.curve(points.cfNeckCp1, points.neckCp2Front, points.neck)
|
||||
.curve(points.neckCp2, points.cbNeck, points.cbNeck)
|
||||
.attr("class", "dashed stroke-xl various");
|
||||
delta = paths.neckOpening.length() * 2 - target;
|
||||
} while (Math.abs(delta) > 1 && options.brianFitCollar && run < 10);
|
||||
delete paths.neckOpening;
|
||||
.attr('class', 'dashed stroke-xl various')
|
||||
delta = paths.neckOpening.length() * 2 - target
|
||||
} while (Math.abs(delta) > 1 && options.brianFitCollar && run < 10)
|
||||
delete paths.neckOpening
|
||||
if (options.brianFitCollar) {
|
||||
debug({
|
||||
style: "success",
|
||||
label: "🏁 Collar fitted",
|
||||
msg: `Target was ${units(target)}, delta of ${units(
|
||||
delta
|
||||
)} reached in ${run} attempts.`
|
||||
});
|
||||
style: 'success',
|
||||
label: '🏁 Collar fitted',
|
||||
msg: `Target was ${units(target)}, delta of ${units(delta)} reached in ${run} attempts.`
|
||||
})
|
||||
} else
|
||||
debug({
|
||||
style: "warning",
|
||||
label: "🚫 Not fittingcollar",
|
||||
msg: "(in Brian)"
|
||||
});
|
||||
style: 'warning',
|
||||
label: '🚫 Not fittingcollar',
|
||||
msg: '(in Brian)'
|
||||
})
|
||||
|
||||
// Anchor point for sampling
|
||||
points.gridAnchor = points.cbHem;
|
||||
points.gridAnchor = points.cbHem
|
||||
|
||||
// Seamline
|
||||
paths.saBase = shared.saBase("back", points, Path);
|
||||
paths.saBase = shared.saBase('back', points, Path)
|
||||
paths.seam = new Path()
|
||||
.move(points.cbNeck)
|
||||
.line(points.cbHem)
|
||||
.join(paths.saBase)
|
||||
.attr("class", "fabric");
|
||||
.attr('class', 'fabric')
|
||||
|
||||
// Complete pattern?
|
||||
if (complete) {
|
||||
points.title = new Point(points.armholePitch.x / 2, points.armholePitch.y);
|
||||
points.logo = points.title.shift(-90, 100);
|
||||
snippets.logo = new Snippet("logo", points.logo);
|
||||
points.title = new Point(points.armholePitch.x / 2, points.armholePitch.y)
|
||||
points.logo = points.title.shift(-90, 100)
|
||||
snippets.logo = new Snippet('logo', points.logo)
|
||||
}
|
||||
|
||||
return part;
|
||||
};
|
||||
return part
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as shared from "./shared";
|
||||
import * as shared from './shared'
|
||||
|
||||
export default part => {
|
||||
let {
|
||||
|
@ -15,80 +15,77 @@ export default part => {
|
|||
complete,
|
||||
paperless,
|
||||
macro
|
||||
} = part.shorthand();
|
||||
} = part.shorthand()
|
||||
|
||||
// Cut arm a bit deeper at the front
|
||||
let deeper = measurements.chestCircumference * options.frontArmholeDeeper;
|
||||
points.armholePitchCp1.x -= deeper;
|
||||
points.armholePitch.x -= deeper;
|
||||
points.armholePitchCp2.x -= deeper;
|
||||
let deeper = measurements.chestCircumference * options.frontArmholeDeeper
|
||||
points.armholePitchCp1.x -= deeper
|
||||
points.armholePitch.x -= deeper
|
||||
points.armholePitchCp2.x -= deeper
|
||||
|
||||
// Rename cb (center back) to cf (center front)
|
||||
for (let key of ["Shoulder", "Armhole", "Waist", "Hips", "Hem"]) {
|
||||
points[`cf${key}`] = new Point(points[`cb${key}`].x, points[`cb${key}`].y);
|
||||
delete points[`cb${key}`];
|
||||
for (let key of ['Shoulder', 'Armhole', 'Waist', 'Hips', 'Hem']) {
|
||||
points[`cf${key}`] = new Point(points[`cb${key}`].x, points[`cb${key}`].y)
|
||||
delete points[`cb${key}`]
|
||||
}
|
||||
// Front neckline points
|
||||
points.neckCp2 = new Point(points.neckCp2Front.x, points.neckCp2Front.y);
|
||||
points.neckCp2 = new Point(points.neckCp2Front.x, points.neckCp2Front.y)
|
||||
|
||||
// Seamline
|
||||
paths.saBase = shared.saBase("front", points, Path);
|
||||
paths.saBase = shared.saBase('front', points, Path)
|
||||
paths.seam = new Path()
|
||||
.move(points.cfNeck)
|
||||
.line(points.cfHem)
|
||||
.join(paths.saBase)
|
||||
.attr("class", "fabric");
|
||||
.attr('class', 'fabric')
|
||||
|
||||
// Store lengths to fit sleeve
|
||||
store.set("frontArmholeLength", shared.armholeLength(points, Path));
|
||||
store.set(
|
||||
"frontShoulderToArmholePitch",
|
||||
shared.shoulderToArmholePitch(points, Path)
|
||||
);
|
||||
store.set('frontArmholeLength', shared.armholeLength(points, Path))
|
||||
store.set('frontShoulderToArmholePitch', shared.shoulderToArmholePitch(points, Path))
|
||||
|
||||
// Complete pattern?
|
||||
if (complete) {
|
||||
macro("cutonfold", {
|
||||
macro('cutonfold', {
|
||||
from: points.cfNeck,
|
||||
to: points.cfHips,
|
||||
grainline: true
|
||||
});
|
||||
macro("title", { at: points.title, nr: 1, title: "front" });
|
||||
snippets.armholePitchNotch = new Snippet("notch", points.armholePitch);
|
||||
})
|
||||
macro('title', { at: points.title, nr: 1, title: 'front' })
|
||||
snippets.armholePitchNotch = new Snippet('notch', points.armholePitch)
|
||||
if (sa) {
|
||||
paths.sa = paths.saBase
|
||||
.offset(sa)
|
||||
.attr("class", "fabric sa")
|
||||
.attr('class', 'fabric sa')
|
||||
.line(points.cfNeck)
|
||||
.move(points.cfHips);
|
||||
paths.sa.line(paths.sa.start());
|
||||
.move(points.cfHips)
|
||||
paths.sa.line(paths.sa.start())
|
||||
}
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
shared.dimensions(macro, points, Path, sa);
|
||||
macro("hd", {
|
||||
shared.dimensions(macro, points, Path, sa)
|
||||
macro('hd', {
|
||||
from: points.cfHips,
|
||||
to: points.hips,
|
||||
y: points.hips.y + sa + 15
|
||||
});
|
||||
macro("vd", {
|
||||
})
|
||||
macro('vd', {
|
||||
from: points.cfHips,
|
||||
to: points.cfNeck,
|
||||
x: points.cfHips.x - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
})
|
||||
macro('hd', {
|
||||
from: points.cfNeck,
|
||||
to: points.neck,
|
||||
y: points.neck.y - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
})
|
||||
macro('hd', {
|
||||
from: points.cfNeck,
|
||||
to: points.shoulder,
|
||||
y: points.neck.y - sa - 30
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
return part;
|
||||
};
|
||||
return part
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
import freesewing from "@freesewing/core";
|
||||
import plugins from "@freesewing/plugin-bundle";
|
||||
import config from "../config";
|
||||
import freesewing from '@freesewing/core'
|
||||
import plugins from '@freesewing/plugin-bundle'
|
||||
import config from '../config'
|
||||
// Parts
|
||||
import draftBase from "./base";
|
||||
import draftBack from "./back";
|
||||
import draftFront from "./front";
|
||||
import draftSleevecap from "./sleevecap";
|
||||
import draftSleeve from "./sleeve";
|
||||
import draftBase from './base'
|
||||
import draftBack from './back'
|
||||
import draftFront from './front'
|
||||
import draftSleevecap from './sleevecap'
|
||||
import draftSleeve from './sleeve'
|
||||
|
||||
// Create design
|
||||
const Pattern = new freesewing.Design(config, plugins);
|
||||
const Pattern = new freesewing.Design(config, plugins)
|
||||
|
||||
// Attach draft methods to prototype
|
||||
Pattern.prototype.draftBase = draftBase;
|
||||
Pattern.prototype.draftBack = draftBack;
|
||||
Pattern.prototype.draftFront = draftFront;
|
||||
Pattern.prototype.draftSleevecap = draftSleevecap;
|
||||
Pattern.prototype.draftSleeve = draftSleeve;
|
||||
Pattern.prototype.draftBase = draftBase
|
||||
Pattern.prototype.draftBack = draftBack
|
||||
Pattern.prototype.draftFront = draftFront
|
||||
Pattern.prototype.draftSleevecap = draftSleevecap
|
||||
Pattern.prototype.draftSleeve = draftSleeve
|
||||
|
||||
export default Pattern;
|
||||
export default Pattern
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
export function saBase(side, points, Path) {
|
||||
let path = new Path();
|
||||
if (side === "back") path.move(points.cbHem);
|
||||
else path.move(points.cfHem);
|
||||
let path = new Path()
|
||||
if (side === 'back') path.move(points.cbHem)
|
||||
else path.move(points.cfHem)
|
||||
path
|
||||
.line(points.hem)
|
||||
.line(points.armhole)
|
||||
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
|
||||
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
|
||||
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
|
||||
.line(points.neck);
|
||||
if (side === "back") {
|
||||
path.curve(points.neckCp2, points.cbNeck, points.cbNeck);
|
||||
.line(points.neck)
|
||||
if (side === 'back') {
|
||||
path.curve(points.neckCp2, points.cbNeck, points.cbNeck)
|
||||
} else {
|
||||
path.curve(points.neckCp2, points.cfNeckCp1, points.cfNeck);
|
||||
path.curve(points.neckCp2, points.cfNeckCp1, points.cfNeck)
|
||||
}
|
||||
|
||||
return path;
|
||||
return path
|
||||
}
|
||||
|
||||
export function armholeLength(points, Path) {
|
||||
|
@ -24,54 +24,50 @@ export function armholeLength(points, Path) {
|
|||
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
|
||||
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
|
||||
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
|
||||
.length();
|
||||
.length()
|
||||
}
|
||||
|
||||
export function shoulderToArmholePitch(points, Path) {
|
||||
return new Path()
|
||||
.move(points.armholePitch)
|
||||
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
|
||||
.length();
|
||||
.length()
|
||||
}
|
||||
|
||||
export function dimensions(macro, points, Path, sa) {
|
||||
macro("pd", {
|
||||
macro('pd', {
|
||||
path: new Path()
|
||||
.move(points.armhole)
|
||||
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
|
||||
.curve(
|
||||
points.armholeHollowCp2,
|
||||
points.armholePitchCp1,
|
||||
points.armholePitch
|
||||
)
|
||||
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
|
||||
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
|
||||
d: sa + 15
|
||||
});
|
||||
macro("pd", {
|
||||
})
|
||||
macro('pd', {
|
||||
path: new Path()
|
||||
.move(points.armholePitch)
|
||||
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
|
||||
d: -15
|
||||
});
|
||||
macro("vd", {
|
||||
})
|
||||
macro('vd', {
|
||||
from: points.hips,
|
||||
to: points.armhole,
|
||||
x: points.hips.x + sa + 15
|
||||
});
|
||||
macro("vd", {
|
||||
})
|
||||
macro('vd', {
|
||||
from: points.hips,
|
||||
to: points.armholePitch,
|
||||
x: points.hips.x + sa + 30
|
||||
});
|
||||
macro("vd", {
|
||||
})
|
||||
macro('vd', {
|
||||
from: points.hips,
|
||||
to: points.shoulder,
|
||||
x: points.hips.x + sa + 45
|
||||
});
|
||||
macro("vd", {
|
||||
})
|
||||
macro('vd', {
|
||||
from: points.hips,
|
||||
to: points.neck,
|
||||
x: points.hips.x + sa + 60
|
||||
});
|
||||
macro("ld", { from: points.neck, to: points.shoulder, d: sa + 15 });
|
||||
})
|
||||
macro('ld', { from: points.neck, to: points.shoulder, d: sa + 15 })
|
||||
}
|
||||
|
|
|
@ -15,33 +15,33 @@ export default part => {
|
|||
complete,
|
||||
paperless,
|
||||
macro
|
||||
} = part.shorthand();
|
||||
} = part.shorthand()
|
||||
|
||||
// Wrist
|
||||
let top = paths.sleevecap.bbox().topLeft.y;
|
||||
let top = paths.sleevecap.bbox().topLeft.y
|
||||
debug({
|
||||
style: "info",
|
||||
label: "🗸 Sleevecap height",
|
||||
style: 'info',
|
||||
label: '🗸 Sleevecap height',
|
||||
msg: units(Math.abs(top))
|
||||
});
|
||||
})
|
||||
debug({
|
||||
style: "info",
|
||||
label: "🗸 Sleevecap width",
|
||||
style: 'info',
|
||||
label: '🗸 Sleevecap width',
|
||||
msg: units(points.bicepsRight.x * 2)
|
||||
});
|
||||
})
|
||||
points.centerWrist = new Point(
|
||||
0,
|
||||
top + measurements.shoulderToWrist * (1 + options.sleeveLengthBonus)
|
||||
);
|
||||
)
|
||||
points.wristRight = points.centerWrist.shift(
|
||||
0,
|
||||
(measurements.wristCircumference * (1 + options.cuffEase)) / 2
|
||||
);
|
||||
points.wristLeft = points.wristRight.rotate(180, points.centerWrist);
|
||||
points.sleeveTip = paths.sleevecap.shiftFractionAlong(0.5);
|
||||
)
|
||||
points.wristLeft = points.wristRight.rotate(180, points.centerWrist)
|
||||
points.sleeveTip = paths.sleevecap.shiftFractionAlong(0.5)
|
||||
|
||||
// Paths
|
||||
paths.sleevecap.render = false;
|
||||
paths.sleevecap.render = false
|
||||
paths.seam = new Path()
|
||||
.move(points.bicepsLeft)
|
||||
.move(points.wristLeft)
|
||||
|
@ -49,67 +49,64 @@ export default part => {
|
|||
.line(points.bicepsRight)
|
||||
.join(paths.sleevecap)
|
||||
.close()
|
||||
.attr("class", "fabric");
|
||||
.attr('class', 'fabric')
|
||||
|
||||
// Anchor point for sampling
|
||||
points.gridAnchor = new Point(0, 0);
|
||||
points.gridAnchor = new Point(0, 0)
|
||||
|
||||
// Complete pattern?
|
||||
if (complete) {
|
||||
points.logo = points.centerBiceps.shiftFractionTowards(
|
||||
points.centerWrist,
|
||||
0.3
|
||||
);
|
||||
snippets.logo = new Snippet("logo", points.logo);
|
||||
macro("title", { at: points.centerBiceps, nr: 3, title: "sleeve" });
|
||||
macro("grainline", { from: points.centerWrist, to: points.centerBiceps });
|
||||
points.logo = points.centerBiceps.shiftFractionTowards(points.centerWrist, 0.3)
|
||||
snippets.logo = new Snippet('logo', points.logo)
|
||||
macro('title', { at: points.centerBiceps, nr: 3, title: 'sleeve' })
|
||||
macro('grainline', { from: points.centerWrist, to: points.centerBiceps })
|
||||
points.scaleboxAnchor = points.scalebox = points.centerBiceps.shiftFractionTowards(
|
||||
points.centerWrist,
|
||||
0.5
|
||||
);
|
||||
macro("scalebox", { at: points.scalebox });
|
||||
)
|
||||
macro('scalebox', { at: points.scalebox })
|
||||
|
||||
points.frontNotch = paths.sleevecap.shiftAlong(
|
||||
paths.sleevecap.length() / 2 -
|
||||
store.get("frontShoulderToArmholePitch") -
|
||||
store.get("sleevecapEase") / 2
|
||||
);
|
||||
store.get('frontShoulderToArmholePitch') -
|
||||
store.get('sleevecapEase') / 2
|
||||
)
|
||||
points.backNotch = paths.sleevecap.shiftAlong(
|
||||
paths.sleevecap.length() / 2 +
|
||||
store.get("backShoulderToArmholePitch") +
|
||||
store.get("sleevecapEase") / 2
|
||||
);
|
||||
snippets.frontNotch = new Snippet("notch", points.frontNotch);
|
||||
snippets.backNotch = new Snippet("bnotch", points.backNotch);
|
||||
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
||||
store.get('backShoulderToArmholePitch') +
|
||||
store.get('sleevecapEase') / 2
|
||||
)
|
||||
snippets.frontNotch = new Snippet('notch', points.frontNotch)
|
||||
snippets.backNotch = new Snippet('bnotch', points.backNotch)
|
||||
if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
macro("vd", {
|
||||
macro('vd', {
|
||||
from: points.wristLeft,
|
||||
to: points.bicepsLeft,
|
||||
x: points.bicepsLeft.x - sa - 15
|
||||
});
|
||||
macro("vd", {
|
||||
})
|
||||
macro('vd', {
|
||||
from: points.wristLeft,
|
||||
to: points.sleeveTip,
|
||||
x: points.bicepsLeft.x - sa - 30
|
||||
});
|
||||
macro("hd", {
|
||||
})
|
||||
macro('hd', {
|
||||
from: points.bicepsLeft,
|
||||
to: points.bicepsRight,
|
||||
y: points.sleeveTip.y - sa - 30
|
||||
});
|
||||
macro("hd", {
|
||||
})
|
||||
macro('hd', {
|
||||
from: points.wristLeft,
|
||||
to: points.wristRight,
|
||||
y: points.wristLeft.y + sa + 30
|
||||
});
|
||||
macro("pd", {
|
||||
})
|
||||
macro('pd', {
|
||||
path: paths.sleevecap.reverse(),
|
||||
d: -1 * sa - 15
|
||||
});
|
||||
})
|
||||
}
|
||||
return part;
|
||||
};
|
||||
return part
|
||||
}
|
||||
|
|
|
@ -2,139 +2,116 @@
|
|||
* Positive values mean sleevecap is longer than armhole
|
||||
*/
|
||||
function sleevecapDelta(store) {
|
||||
return store.get("sleevecapLength") - store.get("sleevecapTarget");
|
||||
return store.get('sleevecapLength') - store.get('sleevecapTarget')
|
||||
}
|
||||
|
||||
function sleevecapAdjust(store) {
|
||||
let delta = sleevecapDelta(store);
|
||||
let factor = store.get("sleeveFactor");
|
||||
if (delta > 0) factor = factor * 0.98;
|
||||
else factor = factor * 1.02;
|
||||
store.set("sleeveFactor", factor);
|
||||
let delta = sleevecapDelta(store)
|
||||
let factor = store.get('sleeveFactor')
|
||||
if (delta > 0) factor = factor * 0.98
|
||||
else factor = factor * 1.02
|
||||
store.set('sleeveFactor', factor)
|
||||
}
|
||||
|
||||
function draftSleevecap(part, run) {
|
||||
let {
|
||||
debug,
|
||||
units,
|
||||
store,
|
||||
measurements,
|
||||
options,
|
||||
Point,
|
||||
points,
|
||||
Path,
|
||||
paths
|
||||
} = part.shorthand();
|
||||
let { debug, units, store, measurements, options, Point, points, Path, paths } = part.shorthand()
|
||||
// Sleeve center axis
|
||||
points.centerBiceps = new Point(0, 0);
|
||||
points.centerBiceps = new Point(0, 0)
|
||||
points.centerCap = points.centerBiceps.shift(
|
||||
90,
|
||||
options.sleevecapTopFactorY *
|
||||
(measurements.bicepsCircumference *
|
||||
(1 + options.bicepsEase) *
|
||||
options.armholeDepthFactor *
|
||||
store.get("sleeveFactor"))
|
||||
);
|
||||
store.get('sleeveFactor'))
|
||||
)
|
||||
|
||||
// Left and right biceps points, limit impact of sleeveFactor to 25%
|
||||
let halfWidth =
|
||||
(measurements.bicepsCircumference * (1 + options.bicepsEase)) / 2;
|
||||
let halfWidth = (measurements.bicepsCircumference * (1 + options.bicepsEase)) / 2
|
||||
points.bicepsLeft = points.centerBiceps.shift(
|
||||
180,
|
||||
halfWidth * options.sleeveWidthGuarantee +
|
||||
halfWidth * (1 - options.sleeveWidthGuarantee) * store.get("sleeveFactor")
|
||||
);
|
||||
points.bicepsRight = points.bicepsLeft.flipX(points.centerBiceps);
|
||||
halfWidth * (1 - options.sleeveWidthGuarantee) * store.get('sleeveFactor')
|
||||
)
|
||||
points.bicepsRight = points.bicepsLeft.flipX(points.centerBiceps)
|
||||
|
||||
// Adapt sleeve center axis
|
||||
points.capLeft = new Point(points.bicepsLeft.x, points.centerCap.y);
|
||||
points.capRight = points.capLeft.flipX();
|
||||
points.capLeft = new Point(points.bicepsLeft.x, points.centerCap.y)
|
||||
points.capRight = points.capLeft.flipX()
|
||||
points.centerCap = points.capLeft.shiftFractionTowards(
|
||||
points.capRight,
|
||||
options.sleevecapTopFactorX
|
||||
);
|
||||
)
|
||||
|
||||
// Pitch points
|
||||
let width = points.bicepsRight.x;
|
||||
let height = points.centerCap.y;
|
||||
let width = points.bicepsRight.x
|
||||
let height = points.centerCap.y
|
||||
points.backPitch = new Point(
|
||||
-1 * width * options.sleevecapBackFactorX,
|
||||
height * options.sleevecapBackFactorY
|
||||
);
|
||||
)
|
||||
points.frontPitch = new Point(
|
||||
width * options.sleevecapFrontFactorX,
|
||||
height * options.sleevecapFrontFactorY
|
||||
);
|
||||
)
|
||||
|
||||
// 4 sleevecap quadrants
|
||||
// Base points
|
||||
points.capQ1Base = points.frontPitch.shiftFractionTowards(
|
||||
points.bicepsRight,
|
||||
0.5
|
||||
);
|
||||
points.capQ2Base = points.frontPitch.shiftFractionTowards(
|
||||
points.centerCap,
|
||||
0.5
|
||||
);
|
||||
points.capQ3Base = points.backPitch.shiftFractionTowards(
|
||||
points.centerCap,
|
||||
0.5
|
||||
);
|
||||
points.capQ4Base = points.backPitch.shiftFractionTowards(
|
||||
points.bicepsLeft,
|
||||
0.5
|
||||
);
|
||||
points.capQ1Base = points.frontPitch.shiftFractionTowards(points.bicepsRight, 0.5)
|
||||
points.capQ2Base = points.frontPitch.shiftFractionTowards(points.centerCap, 0.5)
|
||||
points.capQ3Base = points.backPitch.shiftFractionTowards(points.centerCap, 0.5)
|
||||
points.capQ4Base = points.backPitch.shiftFractionTowards(points.bicepsLeft, 0.5)
|
||||
// Offset points
|
||||
let baseOffset = measurements.bicepsCircumference * (1 + options.bicepsEase);
|
||||
let baseOffset = measurements.bicepsCircumference * (1 + options.bicepsEase)
|
||||
points.capQ1 = points.capQ1Base.shift(
|
||||
points.bicepsRight.angle(points.frontPitch) + 90,
|
||||
baseOffset * options.sleevecapQ1Offset
|
||||
);
|
||||
)
|
||||
points.capQ2 = points.capQ2Base.shift(
|
||||
points.centerCap.angle(points.frontPitch) + 90,
|
||||
baseOffset * options.sleevecapQ2Offset
|
||||
);
|
||||
)
|
||||
points.capQ3 = points.capQ3Base.shift(
|
||||
points.centerCap.angle(points.backPitch) - 90,
|
||||
baseOffset * options.sleevecapQ3Offset
|
||||
);
|
||||
)
|
||||
points.capQ4 = points.capQ4Base.shift(
|
||||
points.bicepsLeft.angle(points.backPitch) - 90,
|
||||
baseOffset * options.sleevecapQ4Offset
|
||||
);
|
||||
)
|
||||
// Control points
|
||||
points.capQ1Cp1 = points.capQ1.shift(
|
||||
points.frontPitch.angle(points.bicepsRight),
|
||||
baseOffset * options.sleevecapQ1Spread1
|
||||
);
|
||||
)
|
||||
points.capQ1Cp2 = points.capQ1.shift(
|
||||
points.frontPitch.angle(points.bicepsRight),
|
||||
baseOffset * options.sleevecapQ1Spread2 * -1
|
||||
);
|
||||
)
|
||||
points.capQ2Cp1 = points.capQ2.shift(
|
||||
points.centerCap.angle(points.frontPitch),
|
||||
baseOffset * options.sleevecapQ2Spread1
|
||||
);
|
||||
)
|
||||
points.capQ2Cp2 = points.capQ2.shift(
|
||||
points.centerCap.angle(points.frontPitch),
|
||||
baseOffset * options.sleevecapQ2Spread2 * -1
|
||||
);
|
||||
)
|
||||
points.capQ3Cp1 = points.capQ3.shift(
|
||||
points.backPitch.angle(points.centerCap),
|
||||
baseOffset * options.sleevecapQ3Spread1
|
||||
);
|
||||
)
|
||||
points.capQ3Cp2 = points.capQ3.shift(
|
||||
points.backPitch.angle(points.centerCap),
|
||||
baseOffset * options.sleevecapQ3Spread2 * -1
|
||||
);
|
||||
)
|
||||
points.capQ4Cp1 = points.capQ4.shift(
|
||||
points.bicepsLeft.angle(points.backPitch),
|
||||
baseOffset * options.sleevecapQ4Spread1
|
||||
);
|
||||
)
|
||||
points.capQ4Cp2 = points.capQ4.shift(
|
||||
points.bicepsLeft.angle(points.backPitch),
|
||||
baseOffset * options.sleevecapQ4Spread2 * -1
|
||||
);
|
||||
)
|
||||
|
||||
// Sleevecap seamline
|
||||
paths.sleevecap = new Path()
|
||||
|
@ -143,21 +120,20 @@ function draftSleevecap(part, run) {
|
|||
.curve(points.capQ1Cp2, points.capQ2Cp1, points.capQ2)
|
||||
.curve(points.capQ2Cp2, points.capQ3Cp1, points.capQ3)
|
||||
.curve(points.capQ3Cp2, points.capQ4Cp1, points.capQ4)
|
||||
.curve(points.capQ4Cp2, points.bicepsLeft, points.bicepsLeft);
|
||||
.curve(points.capQ4Cp2, points.bicepsLeft, points.bicepsLeft)
|
||||
|
||||
// Store sleevecap length
|
||||
store.set("sleevecapLength", paths.sleevecap.length());
|
||||
store.set('sleevecapLength', paths.sleevecap.length())
|
||||
if (run === 0) {
|
||||
let armholeLength =
|
||||
store.get("frontArmholeLength") + store.get("backArmholeLength");
|
||||
let sleevecapEase = armholeLength * options.sleevecapEase;
|
||||
store.set("sleevecapEase", sleevecapEase);
|
||||
store.set("sleevecapTarget", armholeLength + sleevecapEase);
|
||||
let armholeLength = store.get('frontArmholeLength') + store.get('backArmholeLength')
|
||||
let sleevecapEase = armholeLength * options.sleevecapEase
|
||||
store.set('sleevecapEase', sleevecapEase)
|
||||
store.set('sleevecapTarget', armholeLength + sleevecapEase)
|
||||
debug({
|
||||
style: "info",
|
||||
label: "🗸 Sleevecap ease",
|
||||
style: 'info',
|
||||
label: '🗸 Sleevecap ease',
|
||||
msg: units(sleevecapEase)
|
||||
});
|
||||
})
|
||||
|
||||
// Uncomment this line to see all sleevecap iterations
|
||||
//paths[run] = paths.sleevecap;
|
||||
|
@ -165,41 +141,37 @@ function draftSleevecap(part, run) {
|
|||
}
|
||||
|
||||
export default part => {
|
||||
let { debug, store, units, options, Point, points, paths } = part.shorthand();
|
||||
let { debug, store, units, options, Point, points, paths } = part.shorthand()
|
||||
|
||||
store.set("sleeveFactor", 1);
|
||||
let run = 0;
|
||||
let delta = 0;
|
||||
store.set('sleeveFactor', 1)
|
||||
let run = 0
|
||||
let delta = 0
|
||||
do {
|
||||
draftSleevecap(part, run);
|
||||
delta = sleevecapDelta(store);
|
||||
sleevecapAdjust(store);
|
||||
run++;
|
||||
} while (
|
||||
options.brianFitSleeve === true &&
|
||||
run < 30 &&
|
||||
Math.abs(sleevecapDelta(store)) > 2
|
||||
);
|
||||
draftSleevecap(part, run)
|
||||
delta = sleevecapDelta(store)
|
||||
sleevecapAdjust(store)
|
||||
run++
|
||||
} while (options.brianFitSleeve === true && run < 30 && Math.abs(sleevecapDelta(store)) > 2)
|
||||
if (options.brianFitSleeve) {
|
||||
debug({
|
||||
style: "success",
|
||||
label: "🏁 Sleevecap fitted",
|
||||
msg: `Target was ${units(store.get("sleevecapTarget"))}, delta of ${units(
|
||||
style: 'success',
|
||||
label: '🏁 Sleevecap fitted',
|
||||
msg: `Target was ${units(store.get('sleevecapTarget'))}, delta of ${units(
|
||||
delta
|
||||
)} reached in ${run} attempts.`
|
||||
});
|
||||
})
|
||||
} else
|
||||
debug({
|
||||
style: "warning",
|
||||
label: "🚫 Not fittingsleevecap",
|
||||
msg: "(in Brian)"
|
||||
});
|
||||
style: 'warning',
|
||||
label: '🚫 Not fittingsleevecap',
|
||||
msg: '(in Brian)'
|
||||
})
|
||||
|
||||
// Paths
|
||||
paths.sleevecap.attr("class", "fabric");
|
||||
paths.sleevecap.attr('class', 'fabric')
|
||||
|
||||
// Anchor point for sampling
|
||||
points.gridAnchor = new Point(0, 0);
|
||||
points.gridAnchor = new Point(0, 0)
|
||||
|
||||
return part;
|
||||
};
|
||||
return part
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue