1
0
Fork 0

tada: Initial commit

This commit is contained in:
Joost De Cock 2019-04-06 12:30:11 +02:00
parent 2f2fb2ee71
commit 7148fcab1c
14 changed files with 4964 additions and 2 deletions

View file

@ -0,0 +1,13 @@
# editorconfig.org
root = true
[*]
indent_size = 2
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

64
packages/carlita/.gitignore vendored Normal file
View file

@ -0,0 +1,64 @@
*.php
cnf.yml
dist
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# next.js build output
.next

View file

@ -0,0 +1,2 @@
src
.editorconfig

21
packages/carlita/LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Joost De Cock
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,2 +1,27 @@
# carlita
Port of the carlita pattern to JS
<p align="center">
<a title="Go to freesewing.org" href="https://freesewing.org/"><img src="https://freesewing.org/img/logo/black.svg" align="center" width="150px" alt="Freesewing logo"/></a>
</p>
<h4 align="center"><em>&nbsp;<a title="Go to freesewing.org" href="https://freesewing.org/">freesewing</a></em>
<br><sup>a library for made-to-measure sewing patterns</sup>
</h4>
<p align="center">
<a href="https://www.npmjs.com/package/@freesewing/carlita"><img src="https://badgen.net/npm/v/@freesewing/carlita" alt="Version"></a>
<a href="https://www.npmjs.com/package/@freesewing/carlita"><img src="https://badgen.net/npm/license/@freesewing/carlita" alt="License"></a>
<a href="https://deepscan.io/dashboard#view=project&tid=2114&pid=4730&bid=37767"><img src="https://deepscan.io/api/teams/2114/projects/4730/branches/37767/badge/grade.svg" alt="DeepScan grade"></a>
<a href="https://gitter.im/freesewing/freesewing"><img src="https://badgen.net/badge/chat/on%20Gitter/cyan" alt="Chat on Gitter"></a>
<a href="https://freesewing.org/patrons/join"><img src="https://badgen.net/badge/become/a%20Patron/FF5B77" alt="Become a Patron"></a>
</p>
# freesewing / patterns / carlita
Carltita is a [freesewing](https://github.com/freesewing/freesewing) pattern
for Sherlock Holmes cosplay, or just a really nice coat.
See [freesewing.org/patterns/carlita](https://freesewing.org/patterns/carlita)
for more info and examples.
## Install
```
npm i --save @freesewing/carlita
```

View file

@ -0,0 +1,149 @@
import { version } from "../package.json";
export default {
name: "carlita",
version: version,
measurements: [
"bicepsCircumference",
"centerBackNeckToWaist",
"chestCircumference",
"hipsCircumference",
"naturalWaist",
"naturalWaistToHip",
"neckCircumference",
"shoulderSlope",
"shoulderToElbow",
"shoulderToShoulder",
"shoulderToWrist",
"wristCircumference",
"naturalWaistToFloor",
"naturalWaistToSeat",
"seatCircumference",
// For breasts
"highBust",
"bustSpan",
"highPointShoulderToBust"
],
dependencies: {
bentBack: "bentBase",
bentFront: "bentBack",
bentTopSleeve: "bentSleeve",
bentUnderSleeve: "bentSleeve",
carltonFront: "bentFront",
back: "bentBack",
tail: ["carltonFront", "back"],
topSleeve: "bentTopSleeve",
underSleeve: "bentUnderSleeve",
belt: "back",
collarStand: ["carltonFront", "back"],
collar: "collarStand",
cuffFacing: ["topSleeve", "underSleeve"],
pocket: "carltonFront",
pocketFlap: "carltonFront",
pocketLining: "pocket",
chestPocketWelt: "carltonFront",
chestPocketBag: "carltonFront",
innerPocketWelt: "carltonFront",
innerPocketBag: "carltonFront",
innerPocketTab: "carltonFront",
front: "carltonFront",
side: "front"
},
inject: {
bentBack: "bentBase",
bentFront: "bentBack",
bentTopSleeve: "bentSleeve",
bentUnderSleeve: "bentSleeve",
carltonFront: "bentFront",
back: "bentBack",
topSleeve: "bentTopSleeve",
underSleeve: "bentUnderSleeve",
collar: "collarStand",
pocketLining: "pocket",
front: "carltonFront",
side: "front"
},
hide: [
"bentBase",
"bentBack",
"bentFront",
"bentSleeve",
"bentTopSleeve",
"bentUnderSleeve",
"carltonFront"
],
parts: [
"back",
"tail",
"topSleeve",
"underSleeve",
"belt",
"collarStand",
"collar",
"cuffFacing",
"pocket",
"pocketFlap",
"pocketLining",
"chestPocketWelt",
"chestPocketBag",
"innerPocketWelt",
"innerPocketBag",
"innerPocketTab"
],
options: {
// Constants
brianFitSleeve: true,
brianFitCollar: true,
collarFactor: 4.8,
chestShapingMax: 5,
backPleat: 0.048,
lengthBonus: 0,
collarEase: 0.145,
// Options inherited from Bent
acrossBackFactor: { pct: 97, min: 93, max: 100 },
armholeDepthFactor: { pct: 65, min: 50, max: 70 },
bicepsEase: { pct: 20, min: 0, max: 50 },
chestEase: { pct: 10, min: 5, max: 20 },
cuffEase: { pct: 60, min: 30, max: 100 },
shoulderEase: { pct: 0, min: -2, max: 6 },
sleeveBend: { deg: 10, min: 0, max: 20 },
sleevecapHeight: { pct: 45, min: 40, max: 60 },
sleevecapEase: { pct: 1, min: 0, max: 10 },
sleeveLengthBonus: { pct: 7, min: 0, max: 20 },
shoulderSlopeReduction: { pct: 2, min: 1, max: 5 },
backNeckCutout: { pct: 5, min: 2, max: 8 },
frontArmholeDeeper: { pct: 0.5, min: 0, max: 1.5 },
// Carlton options
waistEase: { pct: 14, min: 8, max: 25 },
seatEase: { pct: 14, min: 8, max: 25 },
length: { pct: 69, min: 35, max: 100 },
buttonSpacingHorizontal: { pct: 43.5, min: 15, max: 60 },
frontOverlap: { pct: 1.5, min: 1, max: 2 },
lapelReduction: { pct: 5, min: 0, max: 10 },
pocketPlacementHorizontal: { pct: 11, min: 5, max: 60 },
pocketPlacementVertical: { pct: 6, min: 5, max: 60 },
pocketWidth: { pct: 95, min: 70, max: 120 },
pocketHeight: { pct: 15, min: 0, max: 40 },
pocketRadius: { pct: 20, min: 0, max: 50 },
pocketFlapRadius: { pct: 15, min: 0, max: 50 },
chestPocketHeight: { pct: 60, min: 40, max: 80 },
chestPocketWidth: { pct: 25, min: 15, max: 50 },
chestPocketPlacement: { pct: 55, min: 30, max: 65 },
chestPocketAngle: { deg: 4, min: 0, max: 6 },
innerPocketPlacement: { pct: 53, min: 42, max: 62 },
innerPocketWidth: { pct: 50, min: 45, max: 65 },
innerPocketDepth: { pct: 110, min: 75, max: 140 },
innerPocketWeltHeight: { pct: 3.5, min: 2.5, max: 5 },
beltWidth: { pct: 15, min: 10, max: 20 },
cuffLength: { pct: 15, min: 10, max: 20 },
collarHeight: { pct: 9.6, min: 8, max: 11 },
collarSpread: { deg: 4, min: 2, max: 6 },
collarFlare: { pct: 20, min: 0, max: 40 },
contour: { pct: 50, min: 25, max: 75 }
}
};

View file

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Carlita</title>
<style>
.two {
display: inline-block;
max-width: 95%;
margin: auto;
}
</style>
</head>
<body>
<div id="svg"></div>
<div id="svg1" class="two"></div>
<div id="svg2" class="two"></div>
<script type="text/javascript" src="../../freesewing/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-bundle/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-buttons/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-bust/dist/browser.js"></script>
<script type="text/javascript" src="../bent/dist/browser.js"></script>
<script type="text/javascript" src="../carlton/dist/browser.js"></script>
<script type="text/javascript" src="dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-theme/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-designer/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-debug/dist/browser.js"></script>
<script type="text/javascript" src="../../plugins/plugin-validate/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-i18n/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/models/dist/browser.js"></script>
<script>
let settings = {
"complete": true,
"idPrefix": "fs-",
"locale": "en",
"options": {
"pocketRadius": 0,
//"hemStyle": "rounded",
},
//"embed": true,
"sa": 10,
//"paperless": true,
"measurements": {
"bicepsCircumference": 270,
"centerBackNeckToWaist": 390,
"chestCircumference": 920,
"naturalWaistToHip": 130,
"neckCircumference": 360,
"shoulderToShoulder": 420,
"shoulderSlope": 40,
"shoulderToWrist": 580,
"wristCircumference": 170,
"naturalWaist": 700,
"hipsCircumference": 840,
"seatCircumference": 950,
"shoulderToElbow": 340,
"naturalWaistToFloor": 1060,
"naturalWaistToSeat": 230,
"highBust": 850,
"bustSpan": 170,
"highPointShoulderToBust": 285
},
only: ["front", "side"]
};
var pattern = new freesewing.patterns.carlita(settings);
pattern.use(freesewing.plugins.theme);
pattern.use(freesewing.plugins.designer);
pattern.use(freesewing.plugins.validate);
pattern.draft();
//pattern.sampleOption("collarFlare");
document.getElementById("svg1").innerHTML = pattern.render();
function pointHover(evt) {
var point = evt.target;
var id = point.id;
var cx = point.getAttribute('x');
var cy = point.getAttribute('y');
var name = point.getAttribute('data-point');
var part = point.getAttribute('data-part');
console.log(name+' ('+cx+', '+cy+') @ '+part);
var scale = 2;
cx = cx-scale*cx;
cy = cy-scale*cy;
point.setAttribute("transform", 'matrix('+scale+', 0, 0, '+scale+', '+cx+', '+cy+')');
pointUnhover(id);
}
function pointUnhover(id) {
setTimeout(function(){
document.getElementById(id).removeAttribute("transform", '');
}, 500);
}
</script>
</body>
</html>

3853
packages/carlita/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,83 @@
{
"version": "0.0.1",
"name": "@freesewing/carlita",
"description": "Freesewing pattern for Sherlock Holmes cosplay, or just a nice long coat",
"author": "Joost De Cock <joost@decock.org> (https://github.com/joostdecock)",
"license": "MIT",
"homepage": "https://github.com/freesewing/carlita#readme",
"repository": "github:freesewing/carlita",
"bugs": {
"url": "https://github.com/freesewing/carlita/issues"
},
"keywords": [
"freesewing",
"pattern",
"coat",
"sewing"
],
"main": "dist/index.js",
"module": "dist/index.mjs",
"unpkg": "dist/browser.js",
"scripts": {
"precommit": "npm run pretty && lint-staged",
"patch": "npm version patch -m ':bookmark: v%s' && npm run build",
"minor": "npm version minor -m ':bookmark: v%s' && npm run build",
"major": "npm version major -m ':bookmark: v%s' && npm run build",
"test": "echo \"Error: no test specified\" && exit 1",
"clean": "rimraf dist",
"pretty": "npx prettier --write 'src/*.js'",
"lint": "eslint --fix 'src/*.js'",
"watch": "nodemon -w src -w config --exec 'rollup -c rollup.js -o dist/browser.js -f iife -m true -n freesewing_patterns_carlita --footer \"freesewing.patterns.carlita = freesewing_patterns_carlita;\"'",
"browserbuild": "rollup -c rollup.js -o dist/browser.js -f iife -m true -n freesewing_patterns_carlita --footer 'freesewing.patterns.carlita = freesewing_patterns_carlita;'",
"nodebuild": "rollup -c rollup.js -o dist/index.js -f cjs -m true",
"modulebuild": "rollup -c rollup.js -o dist/index.mjs -f es -m true",
"build": "npm run clean && npm run browserbuild && npm run nodebuild && npm run modulebuild"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,json}": [
"prettier --write",
"git add"
]
},
"dependencies": {
"@freesewing/bent": "0.1.2",
"@freesewing/carlton": "0.2.1",
"@freesewing/plugin-bundle": "0.8.0",
"@freesewing/plugin-bust": "0.1.2",
"@freesewing/plugin-buttons": "0.1.0",
"freesewing": "latest"
},
"devDependencies": {
"@babel/core": "7.4.0",
"@freesewing/antman": "latest",
"@freesewing/models": "latest",
"@freesewing/plugin-debug": "latest",
"@freesewing/plugin-designer": "latest",
"@freesewing/plugin-i18n": "latest",
"@freesewing/plugin-theme": "latest",
"@freesewing/plugin-validate": "latest",
"eslint": "5.15.3",
"eslint-config-prettier": "latest",
"eslint-plugin-prettier": "latest",
"husky": "latest",
"lint-staged": "latest",
"prettier": "latest",
"rimraf": "latest",
"rollup": "1.7.2",
"rollup-plugin-babel": "latest",
"rollup-plugin-babel-minify": "8.0.0",
"rollup-plugin-json": "4.0.0",
"rollup-plugin-node-resolve": "latest"
},
"files": [
"dist/*",
"README.md",
"package-lock.json",
"package.json"
]
}

View file

@ -0,0 +1,35 @@
import babel from "rollup-plugin-babel";
import resolve from "rollup-plugin-node-resolve";
import json from "rollup-plugin-json";
import minify from "rollup-plugin-babel-minify";
import { name, version, description, author, license } from "./package.json";
export default {
input: "src/index.js",
plugins: [
resolve({ browser: true }),
json(),
babel({ exclude: "node_modules/**" }),
minify({
comments: false,
sourceMap: true,
banner: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
})
],
external: [
"freesewing",
"@freesewing/carlton",
"@freesewing/plugin-bundle",
"@freesewing/plugin-buttons",
"@freesewing/plugin-bust"
],
output: {
globals: {
freesewing: "freesewing",
"@freesewing/carlton": "freesewing.patterns.carlton",
"@freesewing/plugin-bundle": "freesewing.plugins.bundle",
"@freesewing/plugin-buttons": "freesewing.plugins.buttons",
"@freesewing/plugin-bust": "freesewing.plugins.bust"
}
}
};

View file

@ -0,0 +1,69 @@
export default function(part) {
let {
paperless,
sa,
snippets,
Snippet,
utils,
store,
complete,
points,
measurements,
options,
macro,
Point,
paths,
Path
} = part.shorthand();
/**
* we're adding half of the proportionate amount of chest east for the bust span
* Only half because this is not where ease is needed or pools
*/
points.bustPoint = new Point(
measurements.bustSpan / 2 +
((measurements.bustSpan / measurements.bust) * options.chestEase) / 4,
points.neck.y + measurements.highPointShoulderToBust
);
// Draw the princess seam (ps)
points.psHem = new Point(points.bustPoint.x, points.hem.y);
points.bustPointCp1 = points.bustPoint.shift(
90,
points.armholePitch.dy(points.bustPoint) / 2
);
// Paths
paths.seam = new Path()
.move(points.psHem)
.line(points.bustPoint)
.curve_(points.bustPointCp1, points.armholePitch)
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
.line(points.neck)
.curve(points.neckCp2Front, points.cfNeckCp1, points.cfNeck)
.line(points.collarTip)
._curve(points.lapelStraightEndCp1, points.lapelStraightEnd)
.line(points.hemEdge)
.line(points.psHem)
.close()
.attr("class", "fabric");
paths.chestPiece = paths.chestPiece
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
.curve(
points.armholeHollowCp2,
points.armholePitchCp1,
points.armholePitch
);
paths.chestPocket = new Path()
.move(points.chestPocketTopLeft)
.line(points.chestPocketBottomLeft)
.line(points.chestPocketBottomRight)
.line(points.chestPocketTopRight)
.line(points.chestPocketTopLeft)
.close()
.attr("class", "fabric help");
return part;
}

View file

@ -0,0 +1,424 @@
export default function(part) {
let {
paperless,
sa,
snippets,
Snippet,
utils,
store,
complete,
points,
measurements,
options,
macro,
Point,
paths,
Path
} = part.shorthand();
/**
* we're adding half of the proportionate amount of chest east for the bust span
* Only half because this is not where ease is needed or pools
*/
points.bustPoint = new Point(
measurements.bustSpan / 2 +
((measurements.bustSpan / measurements.bust) * options.chestEase) / 4,
points.neck.y + measurements.highPointShoulderToBust
);
// Draw the princess seam (ps)
points.psHem = new Point(points.bustPoint.x, points.hem.y);
points.bustPointCp1 = points.bustPoint.shift(
90,
points.armholePitch.dy(points.bustPoint) / 2
);
// Paths
paths.seam = new Path()
.move(points.psHem)
.line(points.bustPoint)
.curve_(points.bustPointCp1, points.armholePitch)
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
.line(points.neck)
.curve(points.neckCp2Front, points.cfNeckCp1, points.cfNeck)
.line(points.collarTip)
._curve(points.lapelStraightEndCp1, points.lapelStraightEnd)
.line(points.hemEdge)
.line(points.psHem)
.close()
.attr("class", "fabric");
paths.chestPiece = paths.chestPiece
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
.curve(
points.armholeHollowCp2,
points.armholePitchCp1,
points.armholePitch
);
paths.chestPocket = new Path()
.move(points.chestPocketTopLeft)
.line(points.chestPocketBottomLeft)
.line(points.chestPocketBottomRight)
.line(points.chestPocketTopRight)
.line(points.chestPocketTopLeft)
.close()
.attr("class", "fabric help");
/////////////////////////////////////////
/**
* We'll shape this side part to fit the bust
* This is not unlike a full bust adjustment (FBA), we'll use 2 rotations
* to slash and spread, and then close the bust dart
*/
let side = [
"bustPoint",
"bustPointCp1",
"psHem",
"hem",
"seat",
"seatCp2",
"waistCp1",
"waist",
"waistCp2",
"armhole",
"armholeCp2",
"armholeHollowCp1",
"armholeHollow",
"armholeHollowCp2",
"armholePitchCp1",
"armholePitch"
];
// Store these, we'll use them in the side part
store.set("side", side);
// How much (horizontal) room do we need to create?
let extra = measurements.bust - measurements.highBust;
/* Cut from armholePitch point to bustPoint and rotate
* entire side panel until we have created enough room */
let added = 0;
let delta = 10;
let count = 1;
while (Math.abs(delta) > 0.5 && count < 50) {
for (let i of side)
points[i + "Rot1"] = points[i].rotate(delta / 5, points.armholePitch);
added = points.bustPoint.dx(points.bustPointRot1);
delta = extra - added;
count++;
}
/* Now cut from armhole to rotated bustpoint and rotate
* the lower part of the site until it's aligned vertically again
* We'll also rotate the top point, thus closing the bust dart */
let angle = -1 * (points.bustPointRot1.angle(points.psHemRot1) - 270);
for (let i of side)
points[i + "Rot2"] = points[i + "Rot1"].rotate(angle, points.bustPointRot1);
// Also rotate original bustPoint and bustPointCp1
points.bustPointRot2 = points.bustPoint.rotate(angle, points.bustPointRot1);
points.bustPointCp1Rot2 = points.bustPointCp1.rotate(
angle,
points.bustPointRot1
);
// Now construct the new curve
points.bustPointCp2 = points.bustPointCp1Rot2
.rotate(180, points.bustPointRot2)
.shiftFractionTowards(points.bustPointRot2, 0.5);
points.psWaist = new Point(points.psHemRot2.x, points.waistRot2.y);
points.psWaistCp1 = points.psWaist.shift(
90,
points.bustPointRot2.dy(points.psWaist) * options.contour
);
// Adapt lenght of the front part
let frontCurve = new Path()
.move(points.armholePitch)
._curve(points.bustPointCp1, points.bustPoint)
.line(new Point(points.psHem.x, points.waist.y))
.length();
let sideCurve = new Path()
.move(points.armholePitchRot2)
._curve(points.bustPointCp1Rot2, points.bustPointRot2)
.curve(points.bustPointCp2, points.psWaistCp1, points.psWaist)
.length();
let longer = sideCurve - frontCurve;
let belowBust = [
"button1Left",
"button2Left",
"button3Left",
"button1Right",
"button2Right",
"button3Right",
"rollLineStart",
"hemEdge",
"flbHem",
"psHem",
"pocketTopLeft",
"pocketTopRight",
"pocketBottomLeft",
"pocketBottomRight",
"pocketRoundLeftStart",
"pocketRoundLeftCp1",
"pocketRoundLeftCp2",
"pocketRoundLeftEnd",
"pocketRoundRightStart",
"pocketRoundRightCp1",
"pocketRoundRightCp2",
"pocketRoundRightEnd",
"pocketFlapTopLeft",
"pocketFlapTopRight",
"pocketFlapBottomLeft",
"pocketFlapBottomRight",
"pocketFlapRoundLeftStart",
"pocketFlapRoundLeftCp1",
"pocketFlapRoundLeftCp2",
"pocketFlapRoundLeftEnd",
"pocketFlapRoundRightStart",
"pocketFlapRoundRightCp1",
"pocketFlapRoundRightCp2",
"pocketFlapRoundRightEnd",
"innerPocketTopLeft",
"innerPocketTopRight",
"innerPocketBottomLeft",
"innerPocketBottomRight",
"chestPocketTopLeft",
"chestPocketTopRight",
"chestPocketBottomLeft",
"chestPocketBottomRight"
];
for (let i of belowBust) {
// Round points depend on options, so add a check
if (typeof points[i] !== "undefined") {
points[i] = points[i].shift(-90, longer);
} else console.log(i);
}
// Move the map/chest pocket into the princess seam
points.chestPocketBottomLeft = new Point(
points.bustPoint.x,
points.button2Right.y - points.button3Right.dy(points.button2Right) / 10
);
points.chestPocketTopLeft = points.chestPocketBottomLeft.shift(
90,
store.get("chestPocketHeight")
);
points.chestPocketTopRight = points.chestPocketTopLeft.shift(
0,
store.get("chestPocketWidth")
);
points.chestPocketBottomRight = points.chestPocketBottomLeft.shift(
0,
store.get("chestPocketWidth")
);
// Uncomment these to better understand the FBA
/*
paths.triangle0 = new Path()
.move(points.bustPoint)
.line(points.armhole)
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
.line(points.bustPoint)
.close()
.attr("class", "dashed lining");
paths.triangle1 = new Path()
.move(points.bustPointRot1)
.line(points.armholeRot1)
.curve(points.armholeCp2Rot1, points.armholeHollowCp1Rot1, points.armholeHollowRot1)
.curve(points.armholeHollowCp2Rot1, points.armholePitchCp1Rot1, points.armholePitch)
.line(points.bustPointRot1)
.close()
.attr("class", "dashed stroke-xl interfacing");
paths.triangle2 = new Path()
.move(points.bustPointRot2)
.line(points.armholeRot2)
.curve(points.armholeCp2Rot2, points.armholeHollowCp1Rot2, points.armholeHollowRot2)
.curve(points.armholeHollowCp2Rot2, points.armholePitchCp1Rot2, points.armholePitchRot2)
.line(points.bustPointRot2)
.close()
.attr("class", "dashed various");
paths.rot = new Path()
.move(points.hemRot2)
.line(points.seatRot2)
.curve(points.seatCp2Rot2, points.waistCp1Rot2, points.waistRot2)
.curve_(points.waistCp2Rot2, points.armholeRot2)
.curve(points.armholeCp2Rot2, points.armholeHollowCp1Rot2, points.armholeHollowRot2)
.curve(points.armholeHollowCp2Rot2, points.armholePitchCp1Rot2, points.armholePitchRot2)
._curve(points.bustPointCp1Rot2, points.bustPointRot2)
.line(points.psHemRot2)
.line(points.hemRot2)
.close()
.attr("class", "interfacing stroke-xl");
*/
// Clean up
for (let i in paths) delete paths[i];
for (let i in snippets) delete snippets[i];
// Paths
paths.saBase = new Path()
.move(points.psHem)
.line(points.bustPoint)
.curve_(points.bustPointCp1, points.armholePitch)
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
.line(points.neck)
.curve(points.neckCp2Front, points.cfNeckCp1, points.cfNeck)
.line(points.collarTip)
._curve(points.lapelStraightEndCp1, points.lapelStraightEnd)
.line(points.hemEdge)
.line(points.flbHem);
paths.seam = paths.saBase
.clone()
.line(points.psHem)
.close()
.attr("class", "fabric");
paths.rollLine = new Path()
.move(points.rollLineStart)
.line(points.rollLineEnd)
.attr("class", "lashed");
paths.flb = new Path()
.move(points.flbHem)
.line(points.flbTop)
.attr("class", "lining lashed");
paths.pocket = new Path()
.move(
utils.beamsIntersect(
points.pocketTopLeft,
points.pocketTopRight,
points.bustPoint,
points.psHem
)
)
.line(points.pocketTopLeft)
.attr("class", "fabric help");
if (options.pocketRadius > 0) {
paths.pocket = paths.pocket
.line(points.pocketRoundLeftStart)
.curve(
points.pocketRoundLeftCp1,
points.pocketRoundLeftCp2,
points.pocketRoundLeftEnd
);
} else {
paths.pocket = paths.pocket
.line(points.pocketBottomLeft)
.line(
utils.beamsIntersect(
points.pocketBottomLeft,
points.pocketBottomRight,
points.bustPoint,
points.psHem
)
);
}
paths.pocketFlap = new Path()
.move(
utils.beamsIntersect(
points.pocketFlapTopLeft,
points.pocketFlapTopRight,
points.bustPoint,
points.psHem
)
)
.line(points.pocketFlapTopLeft)
.attr("class", "fabric help");
if (options.pocketFlapRadius > 0) {
paths.pocketFlap = paths.pocketFlap
.line(points.pocketFlapRoundLeftStart)
.curve(
points.pocketFlapRoundLeftCp1,
points.pocketFlapRoundLeftCp2,
points.pocketFlapRoundLeftEnd
);
} else {
paths.pocketFlap = paths.pocketFlap
.line(points.pocketFlapBottomLeft)
.line(
utils.beamsIntersect(
points.pocketFlapBottomLeft,
points.pocketFlapBottomRight,
points.bustPoint,
points.psHem
)
);
}
paths.chestPocket = new Path()
.move(points.chestPocketTopLeft)
.line(points.chestPocketBottomLeft)
.line(points.chestPocketBottomRight)
.line(points.chestPocketTopRight)
.line(points.chestPocketTopLeft)
.close()
.attr("class", "fabric help");
paths.innerPocket = new Path()
.move(points.innerPocketTopLeft)
.line(points.innerPocketBottomLeft)
.line(points.innerPocketBottomRight)
.line(points.innerPocketTopRight)
.line(points.innerPocketTopLeft)
.close()
.attr("class", "fabric help");
if (complete) {
snippets.button1Left = new Snippet("button", points.button1Left).attr(
"data-scale",
2
);
snippets.button1Right = new Snippet("button", points.button1Right).attr(
"data-scale",
2
);
snippets.button2Left = new Snippet("button", points.button2Left).attr(
"data-scale",
2
);
snippets.button2Right = new Snippet("button", points.button2Right).attr(
"data-scale",
2
);
snippets.button3Left = new Snippet("button", points.button3Left).attr(
"data-scale",
2
);
snippets.button3Right = new Snippet("button", points.button3Right).attr(
"data-scale",
2
);
macro("sprinkle", {
snippet: "notch",
on: [
"cfNeck",
"rollLineStart",
"bustPoint",
"chestPocketTopLeft",
"chestPocketBottomLeft"
]
});
points.logo = points.cfSeat.shiftFractionTowards(points.cfHem, 0.5);
snippets.logo = new Snippet("logo", points.logo);
macro("title", { at: points.title, nr: "1a", title: "front" });
macro("grainline", { from: points.cfHem, to: points.cfNeck });
if (sa) {
let hemBase = new Path().move(points.flbHem).line(points.psHem);
paths.sa = paths.saBase
.offset(sa)
.join(hemBase.offset(3 * sa))
.line(points.psHem.shift(-90, 3 * sa).shift(0, sa))
.close()
.attr("class", "fabric sa");
}
}
return part;
}

View file

@ -0,0 +1,56 @@
import freesewing from "freesewing";
import plugins from "@freesewing/plugin-bundle";
import buttons from "@freesewing/plugin-buttons";
import bust from "@freesewing/plugin-bust";
import Bent from "@freesewing/bent";
import Carlton from "@freesewing/carlton";
import config from "../config";
// Parts
import draftFront from "./front";
import draftSide from "./side";
// Create new design
const Carlita = new freesewing.Design(config, [plugins, buttons, bust]);
let fromBent = ["Base", "Front", "Back", "Sleeve", "TopSleeve", "UnderSleeve"];
// Attach draft methods from Bent to prototype
for (let m of fromBent) {
Carlita.prototype["draftBent" + m] = function(part) {
return new Bent(this.settings)["draft" + m](part);
};
}
// Attach draft methods from Carlton to prototype
for (let m of [
"draftBack",
"draftTail",
"draftTopSleeve",
"draftUnderSleeve",
"draftBelt",
"draftCollarStand",
"draftCollar",
"draftCuffFacing",
"draftPocket",
"draftPocketFlap",
"draftPocketLining",
"draftChestPocketWelt",
"draftChestPocketBag",
"draftInnerPocketWelt",
"draftInnerPocketBag",
"draftInnerPocketTab"
]) {
Carlita.prototype[m] = function(part) {
return new Carlton(this.settings)[m](part);
};
}
Carlita.prototype.draftCarltonFront = function(part) {
return new Carlton(this.settings).draftFront(part);
};
// Attach own draft methods to prototype
Carlita.prototype.draftFront = draftFront;
Carlita.prototype.draftSide = draftSide;
export default Carlita;

View file

@ -0,0 +1,74 @@
export default function(part) {
let {
paperless,
sa,
snippets,
Snippet,
utils,
store,
complete,
points,
measurements,
options,
macro,
Point,
paths,
Path
} = part.shorthand();
// Give points their original names
for (let i of store.get("side")) points[i] = points[i + "Rot2"].clone();
// Clean up
for (let i in paths) delete paths[i];
for (let i in snippets) delete snippets[i];
paths.saBase = new Path()
.move(points.hem)
.line(points.seat)
.curve(points.seatCp2, points.waistCp1, points.waist)
.curve_(points.waistCp2, points.armhole)
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
._curve(points.bustPointCp1, points.bustPoint)
.curve(points.bustPointCp2, points.psWaistCp1, points.psWaist)
.line(points.psHem);
paths.seam = paths.saBase
.clone()
.line(points.hem)
.close()
.attr("class", "fabric");
if (complete) {
points.title = points.psWaist.shiftFractionTowards(points.waist, 0.5);
macro("title", {
at: points.title,
nr: "1b",
title: "side"
});
points.logo = points.psHem.shiftFractionTowards(points.seat, 0.5);
snippets.logo = new Snippet("logo", points.logo);
points.grainlineFrom = points.psHem.shiftFractionTowards(points.hem, 0.5);
points.grainlineTo = new Point(
points.grainlineFrom.x,
points.armholePitchCp1.y
);
macro("grainline", {
from: points.grainlineFrom,
to: points.grainlineTo
});
if (sa) {
paths.sa = paths.saBase
.offset(sa)
.line(points.psHem.shift(-90, 3 * sa).shift(180, sa))
.line(points.hem.shift(-90, 3 * sa).shift(0, sa))
.close()
.attr("class", "fabric sa");
}
}
return part;
}