1
0
Fork 0
freesewing/packages/cornelius/src/front.js

241 lines
6.7 KiB
JavaScript
Raw Normal View History

2021-02-02 06:57:24 -08:00
export default function (part) {
let {
options,
Path,
points,
paths,
Snippet,
snippets,
complete,
2021-02-02 06:57:24 -08:00
sa,
store,
paperless,
macro
} = part.shorthand()
const cc = 0.551915024494 // circle constant
2021-02-02 06:57:24 -08:00
let halfInch = store.get('halfInch')
let ventLength = store.get('ventLength')
let waist = store.get('waist')
let keystone = options.cuffStyle == 'keystone'
2021-02-02 06:57:24 -08:00
2021-02-18 07:47:53 -08:00
let flyWidth = 3.5
store.set('flyWidth', flyWidth)
2021-02-02 06:57:24 -08:00
store.set('sideSeam', paths.sideSeam.length())
2021-02-02 06:57:24 -08:00
points.pZcpR = points.pZ.shiftFractionTowards(points.pX, options.pctZtoR)
points.pRcpZ = points.pR
.shiftFractionTowards(points.pF, options.pctRtoZin)
.shiftFractionTowards(points.pZ, options.pctRtoZup)
let waistAngle = Math.abs(points.pW.angle(points.pD) - points.pW.angle(points.pZ))
if (waistAngle > 180) {
waistAngle -= 180
2021-02-18 07:47:53 -08:00
}
2021-02-02 06:57:24 -08:00
points.flyTop = points.pW.shift(
points.pW.angle(points.pZ) - 180 + waistAngle,
halfInch * flyWidth
)
points.flyBottom = points.flyTop.shift(
points.pW.angle(points.pZ),
points.pW.dist(points.pZ) - halfInch * flyWidth
)
2021-02-02 06:57:24 -08:00
points.pZcpFB = points.pZ.shift(points.pW.angle(points.pZ) - waistAngle, halfInch * flyWidth * cc)
points.pFBcpZ = points.flyBottom.shift(points.pW.angle(points.pZ), halfInch * flyWidth * cc)
2021-02-02 06:57:24 -08:00
2021-02-18 07:47:53 -08:00
paths.fly = new Path()
2021-02-09 18:28:11 -08:00
.move(points.pW)
.line(points.flyTop)
.line(points.flyBottom)
.curve(points.pFBcpZ, points.pZcpFB, points.pZ)
.setRender(false)
paths.flyFold = new Path().move(points.pW).line(points.pZ).attr('class', 'fabric dashed')
2021-02-02 06:57:24 -08:00
store.set('frontWaistLength', paths.waistSeam.line(points.flyTop).length())
2021-02-18 07:47:53 -08:00
paths.crotchSeam = new Path()
.move(points.pZ)
.curve(points.pZcpR, points.pRcpZ, points.pR)
.setRender(false)
points.pRcpK = points.pR
.shiftFractionTowards(points.pF, options.pctRtoKin)
.shiftFractionTowards(points.pK, options.pctRtoKdown)
points.pKcpR = points.pK
.shiftFractionTowards(points.pH, -1 * (options.pctKtoRout + options.fullness))
.shiftFractionTowards(points.pR, options.pctKtoRup)
2021-02-02 06:57:24 -08:00
2021-02-09 07:20:18 -08:00
paths.insideSeam = new Path()
2021-02-02 06:57:24 -08:00
.move(points.pR)
.curve(points.pRcpK, points.pKcpR, points.pK)
.setRender(false)
store.set('insideSeam', paths.insideSeam.length())
2021-02-02 06:57:24 -08:00
let tempP = points.pH.shift(270, halfInch * 1.5)
2021-02-18 07:47:53 -08:00
points.pKcpH = points.pK.shiftFractionTowards(tempP, options.pctKtoH)
points.pJcpH = points.pJ.shiftFractionTowards(tempP, options.pctKtoH)
2021-02-02 06:57:24 -08:00
paths.legSeam = new Path()
.move(points.pK)
.curve(points.pKcpH, points.pJcpH, points.pJ)
.setRender(false)
2021-02-18 07:47:53 -08:00
store.set('frontLegSeam', paths.legSeam.length())
2021-02-18 07:47:53 -08:00
// Keystone original:
// The keystone design has the slit in the cuff to the front. I deviated from
// this for comfort and ease of construction preferences. The 'slit' is now
// part of the side seam.
if (keystone) {
points.pSlitBottom = paths.legSeam.shiftAlong(paths.legSeam.length() - halfInch * 4)
points.pSlitTop = points.pSlitBottom.shift(90, halfInch * 5 * options.ventLength)
store.set('slitDistance', paths.legSeam.length() - halfInch * 4)
}
2021-02-18 07:47:53 -08:00
points.pocketWaist = paths.waistSeam.shiftAlong(waist / 2 / 4.5)
points.pocketSide = paths.sideSeam.shiftAlong(paths.sideSeam.length() - (waist / 2 / 4.5) * 3.5)
paths.pocketSeam = new Path().move(points.pocketSide).line(points.pocketWaist).setRender(false)
2021-02-18 07:47:53 -08:00
paths.waistSeam = paths.waistSeam.split(points.pocketWaist)[1]
paths.sideSeam = paths.sideSeam.split(points.pocketSide)[0]
2021-02-09 07:20:18 -08:00
paths.seam = paths.waistSeam
.join(paths.fly)
.join(paths.crotchSeam)
.join(paths.insideSeam)
.join(paths.legSeam)
.join(paths.sideSeam)
.join(paths.pocketSeam)
2021-02-09 07:20:18 -08:00
.close()
2021-02-02 06:57:24 -08:00
.attr('class', 'fabric')
points.topOfVent = paths.sideSeam.shiftAlong(ventLength)
2021-02-09 07:20:18 -08:00
if (complete) {
snippets.n1 = new Snippet('notch', points.pK)
snippets.n2 = new Snippet('notch', points.pJ)
snippets.n3 = new Snippet('notch', points.pocketWaist)
snippets.n4 = new Snippet('notch', points.pocketSide)
2021-02-02 06:57:24 -08:00
// Keystone original (see above):
if (keystone) {
paths.slit = new Path()
.move(points.pSlitBottom)
.line(points.pSlitTop)
.attr('class', 'fabric')
.attr('data-text', 'vent')
.attr('data-text-class', 'text-xs center')
snippets.n6 = new Snippet('notch', points.pSlitBottom)
} else {
tempP = paths.sideSeam.shiftAlong(ventLength)
paths.vent = paths.sideSeam
.split(tempP)[0]
.attr('data-text', 'vent')
.attr('data-text-class', 'text-xs center')
}
snippets.n5 = new Snippet('notch', points.topOfVent)
2021-02-02 06:57:24 -08:00
points.logo = points.pE.clone()
2021-02-02 06:57:24 -08:00
snippets.logo = new Snippet('logo', points.logo)
2021-02-18 07:47:53 -08:00
points.title = points.logo.shift(270, 50)
2021-02-02 06:57:24 -08:00
macro('title', {
2021-02-18 07:47:53 -08:00
nr: 76,
2021-02-02 06:57:24 -08:00
at: points.title,
title: 'Front'
})
2021-02-18 07:47:53 -08:00
points.__titleNr.attr('data-text-class', 'center')
points.__titleName.attr('data-text-class', 'center')
points.__titlePattern.attr('data-text-class', 'center')
2021-02-02 06:57:24 -08:00
points.scaleboxAnchor = points.pD.shift(270, 60)
2021-02-02 06:57:24 -08:00
macro('scalebox', { at: points.scaleboxAnchor })
2021-03-01 07:26:44 -08:00
macro('grainline', {
from: points.pocketBL.shiftFractionTowards(points.pocketTL, -0.9),
2021-03-01 07:26:44 -08:00
to: points.pocketTL
})
if (sa) {
2021-02-02 06:57:24 -08:00
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
}
}
// Paperless?
if (paperless) {
2021-02-26 07:06:22 -08:00
macro('ld', {
from: points.topOfVent,
to: points.pJ
})
macro('hd', {
from: points.pocketSide,
to: points.pocketWaist,
y: points.pocketWaist.y + 15
2021-02-26 07:06:22 -08:00
})
2021-02-02 06:57:24 -08:00
macro('hd', {
2021-02-18 07:47:53 -08:00
from: points.pW,
2021-02-26 07:06:22 -08:00
to: points.pocketWaist,
y: points.pocketWaist.y + 15
2021-02-26 07:06:22 -08:00
})
macro('hd', {
from: points.pocketWaist,
to: points.flyTop,
y: points.pocketWaist.y + 15
2021-02-02 06:57:24 -08:00
})
macro('hd', {
2021-02-18 07:47:53 -08:00
from: points.pAextra,
to: points.pR
2021-02-02 06:57:24 -08:00
})
2021-02-18 07:47:53 -08:00
macro('hd', {
from: points.pK,
to: points.pJ,
y: points.pJ.y - 15
2021-02-02 06:57:24 -08:00
})
2021-02-18 07:47:53 -08:00
// Keystone original (see above):
if (keystone) {
macro('hd', {
from: points.pSlitBottom,
to: points.pJ,
y: points.pJ.y - 30
})
macro('vd', {
from: points.pSlitTop,
to: points.pSlitBottom,
x: points.pSlitTop.x + 15
})
}
2021-02-26 07:06:22 -08:00
macro('vd', {
from: points.pocketSide,
to: points.pocketWaist,
x: points.pocketSide.x
})
2021-02-02 06:57:24 -08:00
macro('vd', {
2021-02-18 07:47:53 -08:00
from: points.pW,
to: points.pR,
x: points.pR.x
2021-02-02 06:57:24 -08:00
})
macro('vd', {
2021-02-18 07:47:53 -08:00
from: points.pR,
to: points.pK,
x: points.pR.x
2021-02-02 06:57:24 -08:00
})
macro('vd', {
2021-02-18 07:47:53 -08:00
from: points.pW,
to: points.pZ,
x: points.pW.x + 15
2021-02-02 06:57:24 -08:00
})
macro('vd', {
2021-02-18 07:47:53 -08:00
from: points.pJ,
2021-02-26 07:06:22 -08:00
to: points.pocketWaist,
x: points.pocketWaist.x
2021-02-02 06:57:24 -08:00
})
}
return part
}