2019-03-16 11:39:06 +01:00
|
|
|
/*
|
2019-03-17 17:15:59 +01:00
|
|
|
* This collar would benefit from a redesign
|
2019-03-16 11:39:06 +01:00
|
|
|
* but I find collar design to be rather tricky business and
|
|
|
|
* would love the input from someone with more pattern design
|
|
|
|
* experience, or more tailoring exprience.
|
|
|
|
*/
|
|
|
|
|
|
|
|
export default function(part) {
|
2019-08-03 15:03:33 +02:00
|
|
|
let { paperless, sa, snippets, complete, points, options, macro, paths, Path } = part.shorthand()
|
2019-03-16 11:39:06 +01:00
|
|
|
|
|
|
|
// Add extra fabric for collar roll
|
2019-08-03 15:03:33 +02:00
|
|
|
points.collarCbTopRoll = points.collarCbTop.shift(-90, options.collarRoll)
|
|
|
|
points.collarCbTopCpRoll = points.collarCbTopCp.shift(-90, options.collarRoll)
|
|
|
|
points.notchTipRoll = points.notch.shiftOutwards(points.notchTip, options.collarRoll)
|
2019-03-16 11:39:06 +01:00
|
|
|
|
|
|
|
// Mirror to create left half
|
|
|
|
let mirror = [
|
2019-08-03 15:03:33 +02:00
|
|
|
'collarstandCbTopCp',
|
|
|
|
'collarstandTip',
|
|
|
|
'notch',
|
|
|
|
'notchTip',
|
|
|
|
'collarCbTopCp',
|
|
|
|
'notchTipRoll',
|
|
|
|
'collarCbTopCpRoll'
|
|
|
|
]
|
|
|
|
for (let i of mirror) points[i + 'Left'] = points[i].flipX(points.collarCbTop)
|
2019-03-16 11:39:06 +01:00
|
|
|
|
2019-03-16 17:48:02 +01:00
|
|
|
// Clean up
|
2019-08-03 15:03:33 +02:00
|
|
|
for (let i of Object.keys(paths)) delete paths[i]
|
|
|
|
for (let i of Object.keys(snippets)) delete snippets[i]
|
2019-03-16 11:39:06 +01:00
|
|
|
|
2019-03-16 17:48:02 +01:00
|
|
|
// Paths
|
2019-03-16 11:39:06 +01:00
|
|
|
paths.seam = new Path()
|
|
|
|
.move(points.collarstandCbTop)
|
|
|
|
.curve_(points.collarstandCbTopCpLeft, points.collarstandTipLeft)
|
|
|
|
.line(points.notchLeft)
|
|
|
|
.line(points.notchTipRollLeft)
|
|
|
|
._curve(points.collarCbTopCpRollLeft, points.collarCbTopRoll)
|
|
|
|
.curve_(points.collarCbTopCpRoll, points.notchTipRoll)
|
|
|
|
.line(points.notch)
|
|
|
|
.line(points.collarstandTip)
|
|
|
|
._curve(points.collarstandCbTopCp, points.collarstandCbTop)
|
|
|
|
.close()
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'fabric')
|
2019-03-16 11:39:06 +01:00
|
|
|
|
|
|
|
paths.roll = new Path()
|
|
|
|
.move(points.notchTip)
|
|
|
|
._curve(points.collarCbTopCp, points.collarCbTop)
|
|
|
|
.curve_(points.collarCbTopCpLeft, points.notchTipLeft)
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'stroke-sm dashed')
|
2019-03-16 17:48:02 +01:00
|
|
|
|
|
|
|
if (complete) {
|
|
|
|
// Notches
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('sprinkle', {
|
|
|
|
snippet: 'notch',
|
|
|
|
on: ['collarstandCbTop', 'notchTip', 'notchTipLeft']
|
|
|
|
})
|
2019-03-16 17:48:02 +01:00
|
|
|
// Title
|
2019-08-03 15:03:33 +02:00
|
|
|
points.title = points.collarstandCbTopCp.shiftFractionTowards(points.collarCbTopCpRoll, 0.5)
|
|
|
|
macro('title', {
|
2019-03-16 17:48:02 +01:00
|
|
|
at: points.title,
|
|
|
|
nr: 7,
|
2019-08-03 15:03:33 +02:00
|
|
|
title: 'collar'
|
|
|
|
})
|
2019-03-16 17:48:02 +01:00
|
|
|
|
|
|
|
// Grainline
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('grainline', {
|
2019-03-16 17:48:02 +01:00
|
|
|
from: points.collarCbTopRoll,
|
|
|
|
to: points.collarstandCbTop
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-03-16 17:48:02 +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 17:15:59 +01:00
|
|
|
|
|
|
|
if (paperless) {
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('hd', {
|
2019-03-17 17:15:59 +01:00
|
|
|
from: points.collarstandTipLeft,
|
|
|
|
to: points.collarstandTip,
|
|
|
|
y: points.collarstandCbTop.y - sa - 15
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-17 17:15:59 +01:00
|
|
|
from: points.notchLeft,
|
|
|
|
to: points.notch,
|
|
|
|
y: points.collarstandCbTop.y - sa - 30
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-17 17:15:59 +01:00
|
|
|
from: points.notchTipRollLeft,
|
|
|
|
to: points.notchTipRoll,
|
|
|
|
y: points.notchTipRoll.y + sa + 15
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-17 17:15:59 +01:00
|
|
|
from: points.notchTipLeft,
|
|
|
|
to: points.notchTip,
|
|
|
|
y: points.notchTipRoll.y + sa + 30
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 17:15:59 +01:00
|
|
|
from: points.collarCbTopRoll,
|
|
|
|
to: points.collarstandCbTop,
|
|
|
|
x: points.collarCbTopRoll.x + 15
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('ld', {
|
2019-03-17 17:15:59 +01:00
|
|
|
from: points.collarstandTip,
|
|
|
|
to: points.notch,
|
|
|
|
d: sa + 15
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('ld', {
|
2019-03-17 17:15:59 +01:00
|
|
|
from: points.notchTip,
|
|
|
|
to: points.notch,
|
|
|
|
d: -15 - sa
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('ld', {
|
2019-03-17 17:15:59 +01:00
|
|
|
from: points.notchTipRoll,
|
|
|
|
to: points.notch,
|
|
|
|
d: -30 - sa
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-17 17:15:59 +01:00
|
|
|
from: points.notchTipRoll,
|
|
|
|
to: points.collarstandCbTop,
|
|
|
|
x: points.notch.x + sa + 40
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-03-17 17:15:59 +01:00
|
|
|
}
|
2019-03-16 17:48:02 +01:00
|
|
|
}
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return part
|
2019-03-16 11:39:06 +01:00
|
|
|
}
|