2022-09-11 16:59:37 +02:00
|
|
|
export const draftRibbing = function (
|
|
|
|
{
|
2019-01-03 15:19:50 +01:00
|
|
|
store,
|
|
|
|
measurements,
|
|
|
|
options,
|
|
|
|
points,
|
|
|
|
paths,
|
|
|
|
Path,
|
|
|
|
Point,
|
|
|
|
sa,
|
|
|
|
complete,
|
|
|
|
paperless,
|
|
|
|
macro,
|
2021-04-24 10:16:31 +02:00
|
|
|
units,
|
2022-09-11 16:59:37 +02:00
|
|
|
part,
|
|
|
|
},
|
|
|
|
length
|
|
|
|
) {
|
2020-07-19 09:45:17 +02:00
|
|
|
let height = (measurements.hpsToWaistBack + measurements.waistToHips) * options.ribbingHeight
|
|
|
|
if (part.context.settings.sample) store.set('ribbingHeight', height)
|
|
|
|
else store.setIfUnset('ribbingHeight', height)
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
let gap = 25
|
|
|
|
let lead = 50
|
|
|
|
if (length < 125) lead = length / 3
|
2019-01-03 15:19:50 +01:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
points.topLeft = new Point(0, 0)
|
|
|
|
points.topRight = new Point(height * 2, 0)
|
|
|
|
points.leftGapStart = new Point(0, lead)
|
|
|
|
points.rightGapEnd = new Point(points.topRight.x, lead)
|
|
|
|
points.leftGapEnd = new Point(0, lead + gap)
|
|
|
|
points.rightGapStart = new Point(points.topRight.x, lead + gap)
|
|
|
|
points.bottomLeft = new Point(0, gap + 2 * lead)
|
|
|
|
points.bottomRight = new Point(points.topRight.x, gap + 2 * lead)
|
2019-01-03 15:19:50 +01:00
|
|
|
|
|
|
|
paths.seam = new Path()
|
|
|
|
.move(points.rightGapEnd)
|
|
|
|
.line(points.topRight)
|
|
|
|
.line(points.topLeft)
|
|
|
|
.line(points.leftGapStart)
|
|
|
|
.move(points.leftGapEnd)
|
|
|
|
.line(points.bottomLeft)
|
|
|
|
.line(points.bottomRight)
|
|
|
|
.line(points.rightGapStart)
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'various')
|
2019-01-03 15:19:50 +01:00
|
|
|
|
|
|
|
paths.hint = new Path()
|
|
|
|
.move(points.leftGapStart)
|
|
|
|
.line(points.leftGapEnd)
|
|
|
|
.move(points.rightGapStart)
|
|
|
|
.line(points.rightGapEnd)
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'various dashed')
|
2019-01-03 15:19:50 +01:00
|
|
|
|
|
|
|
if (complete) {
|
2019-08-03 15:03:33 +02:00
|
|
|
points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2)
|
2019-01-03 15:19:50 +01:00
|
|
|
if (sa) {
|
|
|
|
paths.sa = new Path()
|
|
|
|
.move(points.topLeft)
|
|
|
|
.line(points.bottomLeft)
|
|
|
|
.line(points.bottomRight)
|
|
|
|
.line(points.topRight)
|
|
|
|
.line(points.topLeft)
|
|
|
|
.close()
|
|
|
|
.offset(sa)
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'various sa')
|
2019-01-03 15:19:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (paperless) {
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('vd', {
|
2019-01-03 15:19:50 +01:00
|
|
|
from: points.bottomRight,
|
|
|
|
to: points.topRight,
|
|
|
|
x: points.topRight.x + sa + 15,
|
2021-04-24 10:16:31 +02:00
|
|
|
text: units(length),
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-01-03 15:19:50 +01:00
|
|
|
from: points.topLeft,
|
|
|
|
to: points.topRight,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.topRight.y - sa - 15,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-01-03 15:19:50 +01:00
|
|
|
}
|
2019-08-03 15:03:33 +02:00
|
|
|
}
|