1
0
Fork 0
freesewing/packages/jaeger/src/topsleeve.js

216 lines
5.6 KiB
JavaScript
Raw Normal View History

export default function (part) {
2019-08-03 15:03:33 +02:00
let {
paperless,
sa,
utils,
complete,
points,
measurements,
options,
macro,
paths,
2021-04-24 10:16:31 +02:00
Path,
2019-08-03 15:03:33 +02:00
} = part.shorthand()
2019-03-16 11:39:06 +01:00
// Vent
2019-08-03 15:03:33 +02:00
let slope = 15
let width = measurements.wrist * (1 + options.cuffEase) * options.sleeveVentWidth
2019-08-03 15:03:33 +02:00
points.ventFoldRight = points.tsWristLeft.shiftOutwards(points.tsWristRight, width)
points.ventHelper = points.tsWristRight.shiftFractionTowards(
points.elbowRight,
options.sleeveVentLength
)
2019-03-16 11:39:06 +01:00
points.ventSlopeEnd = points.ventHelper
.shiftTowards(points.tsWristRight, width)
2019-08-03 15:03:33 +02:00
.rotate(90, points.ventHelper)
2019-03-16 11:39:06 +01:00
points.ventSlopeStart = utils.beamsIntersect(
2019-08-03 15:03:33 +02:00
points.tsWristRight,
points.elbowRight,
points.ventSlopeEnd,
points.ventHelper.rotate(-1 * slope, points.ventSlopeEnd)
)
2019-03-16 11:39:06 +01:00
// Hem
2019-08-03 15:03:33 +02:00
let hemSa = sa ? 3 * sa : 30
2019-03-16 11:39:06 +01:00
points.hemHelperLeft = points.tsWristLeft
.shiftTowards(points.tsWristRight, hemSa)
2019-08-03 15:03:33 +02:00
.rotate(90, points.tsWristLeft)
2019-03-16 11:39:06 +01:00
points.hemHelperRight = points.tsWristRight
.shiftTowards(points.tsWristLeft, hemSa)
2019-08-03 15:03:33 +02:00
.rotate(-90, points.tsWristRight)
2019-03-16 11:39:06 +01:00
points.hemLeftIntersection = utils.beamsIntersect(
2019-08-03 15:03:33 +02:00
points.hemHelperLeft,
points.hemHelperRight,
points.tsWristLeft,
points.tsElbowLeft
)
2019-03-16 11:39:06 +01:00
points.hemRightIntersection = utils.beamsIntersect(
2019-08-03 15:03:33 +02:00
points.hemHelperLeft,
points.hemHelperRight,
points.tsWristRight,
points.elbowRight
)
2019-03-16 11:39:06 +01:00
points.hemVentIntersection = utils.beamsIntersect(
2019-08-03 15:03:33 +02:00
points.hemHelperLeft,
points.hemHelperRight,
points.ventFoldRight,
points.ventSlopeEnd
)
points.hemLeft = points.hemLeftIntersection.rotate(
points.tsWristLeft.angle(points.hemLeftIntersection) * -2,
points.tsWristLeft
)
points.hemRight = points.hemRightIntersection.rotate(
points.tsWristRight.angle(points.hemRightIntersection) * -2,
points.tsWristRight
)
points.ventRight = points.hemVentIntersection.rotate(
points.ventFoldRight.angle(points.hemVentIntersection) * -2,
points.ventFoldRight
)
2019-03-16 11:39:06 +01:00
// Clean up - Remove this and uncomment paths below to understand what's going on
2019-08-03 15:03:33 +02:00
for (let i of Object.keys(paths)) delete paths[i]
2019-03-16 11:39:06 +01:00
// Paths
paths.seam = new Path()
.move(points.ventFoldRight)
.line(points.ventSlopeEnd)
.line(points.ventSlopeStart)
.line(points.elbowRight)
.curve(points.elbowRightCpTop, points.tsRightEdgeCpBottom, points.tsRightEdge)
.curve_(points.tsRightEdgeCpTop, points.backPitchPoint)
._curve(points.topCpRight, points.top)
.curve(points.topCpLeft, points.frontPitchPointCpTop, points.frontPitchPoint)
.curve(points.frontPitchPointCpBottom, points.tsLeftEdgeCpRight, points.tsLeftEdge)
._curve(points.tsElbowLeftCpTop, points.tsElbowLeft)
.line(points.tsWristLeft)
2019-03-16 17:27:22 +01:00
.line(points.hemLeft)
.line(points.ventRight)
2019-03-16 11:39:06 +01:00
.line(points.ventFoldRight)
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric')
2019-03-16 11:39:06 +01:00
paths.ventHint = new Path()
.move(points.ventSlopeStart)
.line(points.tsWristRight)
2019-08-03 15:03:33 +02:00
.attr('class', 'stroke-sm help')
2019-03-16 11:39:06 +01:00
paths.hem = new Path()
.move(points.tsWristLeft)
.line(points.ventFoldRight)
2019-08-03 15:03:33 +02:00
.attr('class', 'fabric lashed')
2019-03-16 11:39:06 +01:00
2019-03-16 17:27:22 +01:00
if (complete) {
2021-01-31 09:22:15 +01:00
macro('scalebox', { at: points.elbowCenter })
2019-03-16 17:27:22 +01:00
// Notches
2019-08-03 15:03:33 +02:00
macro('sprinkle', {
snippet: 'notch',
2021-04-24 10:16:31 +02:00
on: ['top', 'tsElbowLeft', 'elbowRight'],
2019-08-03 15:03:33 +02:00
})
2019-03-16 17:27:22 +01:00
// Title
2019-08-03 15:03:33 +02:00
points.title = points.tsLeftEdge.shiftFractionTowards(points.tsRightEdge, 0.5)
macro('title', {
2019-03-16 17:27:22 +01:00
at: points.title,
nr: 4,
2021-04-24 10:16:31 +02:00
title: 'topSleeve',
2019-08-03 15:03:33 +02:00
})
2019-03-16 17:27:22 +01:00
// Grainline
2019-08-03 15:03:33 +02:00
macro('grainline', {
2019-03-16 17:27:22 +01:00
from: points.boxBottom,
2021-04-24 10:16:31 +02:00
to: points.top,
2019-08-03 15:03:33 +02:00
})
2019-03-16 17:27:22 +01:00
2019-08-03 15:03:33 +02:00
if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
2019-03-17 16:53:09 +01:00
if (paperless) {
2019-08-03 15:03:33 +02:00
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.tsWristLeft,
to: points.tsWristRight,
2021-04-24 10:16:31 +02:00
d: 15,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.tsWristLeft,
to: points.ventFoldRight,
2021-04-24 10:16:31 +02:00
d: 30,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.hemLeft,
to: points.ventRight,
2021-04-24 10:16:31 +02:00
d: -15 - sa,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.hemLeft,
to: points.tsWristLeft,
2021-04-24 10:16:31 +02:00
d: 15 + sa,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.tsWristRight,
to: points.ventSlopeStart,
2021-04-24 10:16:31 +02:00
d: 15,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.ventFoldRight,
to: points.ventSlopeEnd,
2021-04-24 10:16:31 +02:00
d: 15,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.tsWristRight,
to: points.ventFoldRight,
2021-04-24 10:16:31 +02:00
d: -15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 16:53:09 +01:00
from: points.ventRight,
to: points.top,
2021-04-24 10:16:31 +02:00
x: points.ventSlopeEnd.x + sa + 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 16:53:09 +01:00
from: points.tsWristLeft,
to: points.tsElbowLeft,
2021-04-24 10:16:31 +02:00
x: points.tsLeftEdge.x - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 16:53:09 +01:00
from: points.tsWristLeft,
to: points.tsLeftEdge,
2021-04-24 10:16:31 +02:00
x: points.tsLeftEdge.x - sa - 30,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 16:53:09 +01:00
from: points.tsLeftEdge,
to: points.top,
2021-04-24 10:16:31 +02:00
x: points.tsLeftEdge.x - sa - 30,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
2019-03-17 16:53:09 +01:00
from: points.tsWristLeft,
to: points.top,
2021-04-24 10:16:31 +02:00
x: points.tsLeftEdge.x - sa - 45,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.tsLeftEdge,
2021-04-24 10:16:31 +02:00
to: points.tsRightEdge,
2019-08-03 15:03:33 +02:00
})
macro('ld', {
2019-03-17 16:53:09 +01:00
from: points.tsElbowLeft,
2021-04-24 10:16:31 +02:00
to: points.elbowRight,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-03-17 16:53:09 +01:00
from: points.tsLeftEdge,
to: points.top,
2021-04-24 10:16:31 +02:00
y: points.top.y - sa - 15,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-03-17 16:53:09 +01:00
from: points.tsLeftEdge,
to: points.backPitchPoint,
2021-04-24 10:16:31 +02:00
y: points.top.y - sa - 30,
2019-08-03 15:03:33 +02:00
})
macro('hd', {
2019-03-17 16:53:09 +01:00
from: points.tsLeftEdge,
to: points.tsRightEdge,
2021-04-24 10:16:31 +02:00
y: points.top.y - sa - 45,
2019-08-03 15:03:33 +02:00
})
2019-03-17 16:53:09 +01:00
}
2019-03-16 17:27:22 +01:00
}
2019-08-03 15:03:33 +02:00
return part
2019-03-16 11:39:06 +01:00
}