1
0
Fork 0
freesewing/designs/cornelius/src/front.mjs

253 lines
7.1 KiB
JavaScript
Raw Normal View History

2022-09-05 10:35:01 -07:00
import { pluginBundle } from '@freesewing/plugin-bundle'
import { frontpoints } from './frontpoints.mjs'
2022-09-11 14:02:00 +02:00
function draftCorneliusFront({
options,
Path,
points,
paths,
Snippet,
snippets,
complete,
sa,
store,
paperless,
macro,
part,
}) {
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)
.hide()
paths.flyFold = new Path().move(points.pW).line(points.pZ).attr('class', 'fabric dashed')
2021-10-20 13:03:27 -07:00
store.set('flyLength', paths.flyFold.length())
2021-02-02 06:57:24 -08:00
store.set('frontWaistLength', paths.waistSeam.line(points.flyTop).length())
paths.crotchSeam = new Path().move(points.pZ).curve(points.pZcpR, points.pRcpZ, points.pR).hide()
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
paths.insideSeam = new Path().move(points.pR).curve(points.pRcpK, points.pKcpR, points.pK).hide()
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).hide()
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).hide()
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-10-20 13:03:27 -07:00
snippets.n5 = new Snippet('notch', points.pZ)
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,
2021-04-24 10:16:31 +02:00
title: 'Front',
2021-02-02 06:57:24 -08:00
})
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-04-24 10:16:31 +02:00
to: points.pocketTL,
2021-03-01 07:26:44 -08:00
})
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,
2021-04-24 10:16:31 +02:00
to: points.pJ,
2021-02-26 07:06:22 -08:00
})
macro('hd', {
from: points.pocketSide,
to: points.pocketWaist,
2021-04-24 10:16:31 +02:00
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,
2021-04-24 10:16:31 +02:00
y: points.pocketWaist.y + 15,
2021-02-26 07:06:22 -08:00
})
macro('hd', {
from: points.pocketWaist,
to: points.flyTop,
2021-04-24 10:16:31 +02:00
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,
2021-04-24 10:16:31 +02:00
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,
2021-04-24 10:16:31 +02:00
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,
2021-04-24 10:16:31 +02:00
y: points.pJ.y - 30,
})
macro('vd', {
from: points.pSlitTop,
to: points.pSlitBottom,
2021-04-24 10:16:31 +02:00
x: points.pSlitTop.x + 15,
})
}
2021-02-26 07:06:22 -08:00
macro('vd', {
from: points.pocketSide,
to: points.pocketWaist,
2021-04-24 10:16:31 +02:00
x: points.pocketSide.x,
2021-02-26 07:06:22 -08:00
})
2021-02-02 06:57:24 -08:00
macro('vd', {
2021-02-18 07:47:53 -08:00
from: points.pW,
to: points.pR,
2021-04-24 10:16:31 +02:00
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,
2021-04-24 10:16:31 +02:00
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,
2021-04-24 10:16:31 +02:00
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,
2021-04-24 10:16:31 +02:00
x: points.pocketWaist.x,
2021-02-02 06:57:24 -08:00
})
}
return part
}
2022-09-05 10:35:01 -07:00
export const front = {
name: 'cornelius.front',
from: frontpoints,
options: {
pctZtoR: 0.35,
pctRtoZin: 0.75,
pctRtoZup: 0.25,
pctRtoKin: 0.75,
pctRtoKdown: 0.25,
pctKtoRout: 0.15,
pctKtoRup: 0.25,
pctKtoH: 0.7,
},
2022-09-11 14:02:00 +02:00
plugins: [pluginBundle],
2022-09-05 10:35:01 -07:00
draft: draftCorneliusFront,
}