construction: Working cutonfold macro
This commit is contained in:
parent
4d949cd56e
commit
7f1bca7ed5
10 changed files with 26 additions and 483 deletions
1
packages/brian/.gitignore
vendored
1
packages/brian/.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
|
dist
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
|
|
281
packages/brian/dist/browser/bundle.js
vendored
281
packages/brian/dist/browser/bundle.js
vendored
File diff suppressed because one or more lines are too long
57
packages/brian/dist/node/back.js
vendored
57
packages/brian/dist/node/back.js
vendored
|
@ -1,57 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
|
|
||||||
var _freesewing = require('freesewing');
|
|
||||||
|
|
||||||
var _freesewing2 = _interopRequireDefault(_freesewing);
|
|
||||||
|
|
||||||
var _base = require('./base');
|
|
||||||
|
|
||||||
var _base2 = _interopRequireDefault(_base);
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
||||||
|
|
||||||
var back = {
|
|
||||||
draft: function draft(part, context) {
|
|
||||||
var _F$utils$shorthand = _freesewing2.default.utils.shorthand(part, context),
|
|
||||||
measurements = _F$utils$shorthand.measurements,
|
|
||||||
options = _F$utils$shorthand.options,
|
|
||||||
points = _F$utils$shorthand.points,
|
|
||||||
paths = _F$utils$shorthand.paths,
|
|
||||||
snippets = _F$utils$shorthand.snippets,
|
|
||||||
macro = _F$utils$shorthand.macro,
|
|
||||||
final = _F$utils$shorthand.final,
|
|
||||||
paperless = _F$utils$shorthand.paperless;
|
|
||||||
|
|
||||||
console.log('shorthand', _freesewing2.default.utils.shorthand(part, context));
|
|
||||||
_base2.default.draft(part, context);
|
|
||||||
|
|
||||||
paths.seam = new _freesewing2.default.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();
|
|
||||||
|
|
||||||
// Final?
|
|
||||||
|
|
||||||
var decorate = function decorate(part, context) {
|
|
||||||
macro('cof', {
|
|
||||||
from: points.cbNeck,
|
|
||||||
to: points.cbHips
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (final) {
|
|
||||||
decorate(part, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Paperless?
|
|
||||||
|
|
||||||
var gauge = function gauge(part, context) {};
|
|
||||||
|
|
||||||
if (paperless) {
|
|
||||||
gauge(part, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.default = back;
|
|
60
packages/brian/dist/node/base.js
vendored
60
packages/brian/dist/node/base.js
vendored
|
@ -1,60 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
|
|
||||||
var _freesewing = require('freesewing');
|
|
||||||
|
|
||||||
var _freesewing2 = _interopRequireDefault(_freesewing);
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
||||||
|
|
||||||
var base = {
|
|
||||||
draft: function draft(part, context) {
|
|
||||||
var _F$utils$shorthand = _freesewing2.default.utils.shorthand(part, context),
|
|
||||||
measurements = _F$utils$shorthand.measurements,
|
|
||||||
options = _F$utils$shorthand.options,
|
|
||||||
points = _F$utils$shorthand.points,
|
|
||||||
paths = _F$utils$shorthand.paths,
|
|
||||||
snippets = _F$utils$shorthand.snippets;
|
|
||||||
|
|
||||||
// Center back (cb) vertical axis
|
|
||||||
|
|
||||||
|
|
||||||
points.cbNeck = new _freesewing2.default.point(0, options.backNeckCutout);
|
|
||||||
points.cbShoulder = new _freesewing2.default.point(0, (measurements.shoulderSlope - options.shoulderSlopeReduction) / 2);
|
|
||||||
points.cbArmhole = new _freesewing2.default.point(0, points.cbShoulder.y + (measurements.bicepsCircumference + options.bicepsEase) * options.armholeDepthFactor);
|
|
||||||
points.cbWaist = new _freesewing2.default.point(0, measurements.centerBackNeckToWaist + options.backNeckCutout);
|
|
||||||
points.cbHips = new _freesewing2.default.point(0, points.cbWaist.y + measurements.naturalWaistToHip);
|
|
||||||
|
|
||||||
// Side back (cb) vertical axis
|
|
||||||
points.armhole = new _freesewing2.default.point(measurements.chestCircumference / 4 + options.chestEase / 4, points.cbArmhole.y);
|
|
||||||
points.waist = new _freesewing2.default.point(points.armhole.x, points.cbWaist.y);
|
|
||||||
points.hips = new _freesewing2.default.point(points.armhole.x, points.cbHips.y);
|
|
||||||
|
|
||||||
// Shoulder line
|
|
||||||
points.neck = new _freesewing2.default.point(measurements.neckCircumference / options.collarFactor, 0);
|
|
||||||
points.shoulder = new _freesewing2.default.point(measurements.shoulderToShoulder / 2 + options.shoulderEase / 2, points.cbShoulder.y);
|
|
||||||
|
|
||||||
// Armhhole
|
|
||||||
points.armholePitch = new _freesewing2.default.point(measurements.shoulderToShoulder * options.acrossBackFactor / 2, points.shoulder.y + points.shoulder.dy(points.armhole) / 2);
|
|
||||||
points._tmp1 = new _freesewing2.default.point(points.armholePitch.x, points.armhole.y);
|
|
||||||
points._tmp2 = points._tmp1.shift(45, 10);
|
|
||||||
points._tmp3 = _freesewing2.default.utils.beamsCross(points._tmp1, points._tmp2, points.armhole, points.armholePitch);
|
|
||||||
points.armholeHollow = points._tmp1.shiftFractionTowards(points._tmp3, 0.5);
|
|
||||||
points.armholeCp1 = points.armhole.shift(180, points._tmp1.dx(points.armhole) / 4);
|
|
||||||
points.armholeCp2 = points.armholeHollow.shift(-45, points.armholeHollow.dy(points.armhole) / 2);
|
|
||||||
points.armholeHollowCp1 = points.armholeHollow.shift(135, points.armholePitch.dx(points.armholeHollow));
|
|
||||||
points.armholeHollowCp2 = points.armholePitch.shift(-90, points.armholePitch.dy(points.armholeHollow) / 2);
|
|
||||||
points.armholePitchCp1 = points.armholePitch.shift(90, points.shoulder.dy(points.armholePitch) / 2);
|
|
||||||
points.armholePitchCp2 = points.shoulder.shiftTowards(points.neck, points.shoulder.dy(points.armholePitch) / 5).rotate(90, points.shoulder);
|
|
||||||
|
|
||||||
// Neck opening
|
|
||||||
points._tmp4 = points.neck.shiftTowards(points.shoulder, 10).rotate(-90, points.neck);
|
|
||||||
points.neckCp1 = _freesewing2.default.utils.beamCrossesY(points.neck, points._tmp4, points.cbNeck.y);
|
|
||||||
points.neckCp2 = points.cbNeck.shift(0, points.cbNeck.dx(points.neck) / 2);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.default = base;
|
|
27
packages/brian/dist/node/index.js
vendored
27
packages/brian/dist/node/index.js
vendored
|
@ -1,27 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var _freesewing = require('freesewing');
|
|
||||||
|
|
||||||
var _freesewing2 = _interopRequireDefault(_freesewing);
|
|
||||||
|
|
||||||
var _config = require('../config/config');
|
|
||||||
|
|
||||||
var patternConfig = _interopRequireWildcard(_config);
|
|
||||||
|
|
||||||
var _back = require('./back');
|
|
||||||
|
|
||||||
var _back2 = _interopRequireDefault(_back);
|
|
||||||
|
|
||||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
||||||
|
|
||||||
var brian = new _freesewing2.default.pattern(patternConfig);
|
|
||||||
|
|
||||||
brian.draft = function () {
|
|
||||||
_back2.default.draft(brian.parts.back, brian.context);
|
|
||||||
|
|
||||||
return brian;
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = brian;
|
|
|
@ -23,59 +23,12 @@
|
||||||
shoulderToWrist: 700,
|
shoulderToWrist: 700,
|
||||||
wristCircumference: 190
|
wristCircumference: 190
|
||||||
};
|
};
|
||||||
pattern.settings.paperless = true;
|
|
||||||
//pattern.on('preRenderSvg', function(next) {
|
|
||||||
// this.attributes.add("viewBox", "-10 -10 600 800");
|
|
||||||
// next();
|
|
||||||
//});
|
|
||||||
var macroPlugin = {
|
|
||||||
hooks: {
|
|
||||||
preRenderSvg: function(next) {
|
|
||||||
console.log('in mixed plugin hooks part');
|
|
||||||
this.attributes.add("viewBox", "-12 -12 600 800");
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
, macros: {
|
|
||||||
cof: function(next, so) {
|
|
||||||
console.log('in mixed plugin macros part');
|
|
||||||
let points = this.points;
|
|
||||||
points.cofStart = so.from.shiftTowards(so.to, 30);
|
|
||||||
points.cofEnd = so.to.shiftTowards(so.from, 30);
|
|
||||||
points.cofVia1 = so.from.shiftTowards(so.to, 50).rotate(90,points.cofStart);
|
|
||||||
points.cofVia2 = so.to.shiftTowards(so.from, 50).rotate(-90,points.cofEnd);
|
|
||||||
this.paths.cof = new this.path()
|
|
||||||
.move(points.cofStart)
|
|
||||||
.line(points.cofVia1)
|
|
||||||
.line(points.cofVia2)
|
|
||||||
.line(points.cofEnd)
|
|
||||||
.attr('class', 'cut-on-fold');
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//pattern.macro('cof', function(next, so) {
|
|
||||||
// let points = this.points;
|
|
||||||
// points.cofStart = so.from.shiftTowards(so.to, 30);
|
|
||||||
// points.cofEnd = so.to.shiftTowards(so.from, 30);
|
|
||||||
// points.cofVia1 = so.from.shiftTowards(so.to, 50).rotate(90,points.cofStart);
|
|
||||||
// points.cofVia2 = so.to.shiftTowards(so.from, 50).rotate(-90,points.cofEnd);
|
|
||||||
// this.paths.cof = new this.path()
|
|
||||||
// .move(points.cofStart)
|
|
||||||
// .line(points.cofVia1)
|
|
||||||
// .line(points.cofVia2)
|
|
||||||
// .line(points.cofEnd)
|
|
||||||
// .attr('class', 'cut-on-fold');
|
|
||||||
// next();
|
|
||||||
//});
|
|
||||||
//pattern.on('postRenderSvg', function(next) {
|
|
||||||
// this.svg = this.svg.replace('green', 'yellow');
|
|
||||||
// next();
|
|
||||||
//});
|
|
||||||
//console.log(freesewing_theme_default);
|
|
||||||
pattern.withPlugin(freesewing_theme_designer);
|
pattern.withPlugin(freesewing_theme_designer);
|
||||||
pattern.withPlugin(freesewing_theme_default);
|
pattern.withPlugin(freesewing_theme_default);
|
||||||
pattern.withPlugin(macroPlugin);
|
pattern.on('preRenderSvg', function(next) {
|
||||||
|
this.attributes.add('viewBox', '-10 -10 400 600');
|
||||||
|
next();
|
||||||
|
});
|
||||||
pattern.draft();
|
pattern.draft();
|
||||||
document.getElementById("svg").innerHTML = pattern.render();
|
document.getElementById("svg").innerHTML = pattern.render();
|
||||||
function pointHover(evt) {
|
function pointHover(evt) {
|
||||||
|
|
5
packages/brian/package-lock.json
generated
5
packages/brian/package-lock.json
generated
|
@ -915,6 +915,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@freesewing-plugins/macro-cutonfold": {
|
||||||
|
"version": "0.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@freesewing-plugins/macro-cutonfold/-/macro-cutonfold-0.2.1.tgz",
|
||||||
|
"integrity": "sha512-zPklEytV9iqRkxgpOYegkox7C2W+j88tO3O5idZqf1vIwWQPOx+ktv5Y0Pt1yT/+Knmv7YLEUVy5XGMRE1uR8w=="
|
||||||
|
},
|
||||||
"@webassemblyjs/ast": {
|
"@webassemblyjs/ast": {
|
||||||
"version": "1.5.13",
|
"version": "1.5.13",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.5.13.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.5.13.tgz",
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
"description": "Freesewing pattern for a basic body block for menswear",
|
"description": "Freesewing pattern for a basic body block for menswear",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"freesewing",
|
"freesewing",
|
||||||
"macro",
|
"pattern",
|
||||||
"sewing",
|
"sewing",
|
||||||
"patterns",
|
"menswear",
|
||||||
"cut on fold"
|
"block"
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/freesewing-patterns/brian#readme",
|
"homepage": "https://github.com/freesewing-patterns/brian#readme",
|
||||||
"repository": "github:freesewing-patterns/brian",
|
"repository": "github:freesewing-patterns/brian",
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
"dev": "webpack-dev-server --open"
|
"dev": "webpack-dev-server --open"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@freesewing-plugins/macro-cutonfold": "0.2.1",
|
||||||
"freesewing": "^0.3.1"
|
"freesewing": "^0.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -39,5 +40,11 @@
|
||||||
"babel-loader": "8.0.0-beta.4",
|
"babel-loader": "8.0.0-beta.4",
|
||||||
"webpack": "4.16.0",
|
"webpack": "4.16.0",
|
||||||
"webpack-cli": "3.0.8"
|
"webpack-cli": "3.0.8"
|
||||||
}
|
},
|
||||||
|
"files": [
|
||||||
|
"dist/*",
|
||||||
|
"README.md",
|
||||||
|
"package-lock.json",
|
||||||
|
"package.json"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ var back =
|
||||||
draft: function(part, context)
|
draft: function(part, context)
|
||||||
{
|
{
|
||||||
let { measurements, options, points, paths, snippets, macro, final, paperless } = F.utils.shorthand(part, context);
|
let { measurements, options, points, paths, snippets, macro, final, paperless } = F.utils.shorthand(part, context);
|
||||||
console.log('shorthand', F.utils.shorthand(part, context));
|
|
||||||
base.draft(part, context);
|
base.draft(part, context);
|
||||||
|
|
||||||
paths.seam = new F.path()
|
paths.seam = new F.path()
|
||||||
|
@ -26,9 +25,10 @@ console.log('shorthand', F.utils.shorthand(part, context));
|
||||||
|
|
||||||
var decorate = function(part, context)
|
var decorate = function(part, context)
|
||||||
{
|
{
|
||||||
macro('cof', {
|
macro('cutonfold', {
|
||||||
from: points.cbNeck
|
from: points.cbNeck
|
||||||
, to: points.cbHips
|
, to: points.cbHips
|
||||||
|
, grainline: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import F from 'freesewing'
|
import F from 'freesewing'
|
||||||
|
import cutonfold from '@freesewing-plugins/macro-cutonfold'
|
||||||
import * as patternConfig from '../config/config'
|
import * as patternConfig from '../config/config'
|
||||||
import back from './back'
|
import back from './back'
|
||||||
|
|
||||||
var brian = new F.pattern(patternConfig);
|
var brian = new F.pattern(patternConfig)
|
||||||
|
.withPlugin(cutonfold);
|
||||||
|
|
||||||
brian.draft = function()
|
brian.draft = function()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue