1
0
Fork 0
freesewing/designs/wahid/src/pocketinterfacing.mjs

90 lines
2.3 KiB
JavaScript
Raw Normal View History

2022-09-03 15:41:48 +02:00
import { pocketWidth, pocketAngle, weltHeight } from './options.mjs'
2022-09-11 08:14:04 -07:00
function wahidPocketInterfacing({
points,
Point,
paths,
Path,
measurements,
options,
macro,
complete,
paperless,
part,
}) {
2022-09-03 15:41:48 +02:00
const pw = measurements.hips * options.pocketWidth // Pocket width
const pwh = pw * options.weltHeight // Pocket welt height
2019-08-03 15:03:33 +02:00
points.topLeft = new Point(0, 0)
points.topRight = new Point(pw + 30, 0)
points.bottomLeft = new Point(0, pwh + 20)
points.bottomRight = new Point(points.topRight.x, points.bottomLeft.y)
points.notchLeft = new Point(15, 10)
points.notchRight = new Point(pw + 15, 10)
paths.seam = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.close()
2019-08-03 15:03:33 +02:00
.attr('class', 'interfacing')
if (complete) {
2019-08-03 15:03:33 +02:00
points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5)
macro('title', {
nr: 8,
2019-08-03 15:03:33 +02:00
title: 'pocketInterfacing',
2021-04-24 10:16:31 +02:00
at: points.title,
2019-08-03 15:03:33 +02:00
})
2022-08-13 21:09:23 +00:00
//Grainline
2022-08-14 08:44:50 +00:00
let grainlineVariableShift = points.topLeft.dist(points.topRight) * 0.1
points.grainlineFromInterfacing = new Point(points.topLeft.x, points.topLeft.y).shift(
0,
grainlineVariableShift
)
2022-08-13 21:09:23 +00:00
points.grainlineToInterfacing = new Point(points.topLeft.x, points.topLeft.y)
2022-08-14 08:44:50 +00:00
.shift(0, grainlineVariableShift)
2022-08-13 21:09:23 +00:00
.shift(-90, pwh + 20)
points.grainlineToInterfacingRotated = points.grainlineToInterfacing.rotate(
options.pocketAngle,
points.grainlineFromInterfacing
)
macro('grainline', {
from: points.grainlineFromInterfacing,
to: points.grainlineToInterfacingRotated,
})
2019-08-03 15:03:33 +02:00
macro('sprinkle', {
snippet: 'notch',
2021-04-24 10:16:31 +02:00
on: ['notchLeft', 'notchRight'],
2019-08-03 15:03:33 +02:00
})
paths.cutline = new Path()
.move(points.notchLeft)
.line(points.notchRight)
2019-08-03 15:03:33 +02:00
.attr('class', 'interfacing stroke-sm dashed')
}
if (paperless) {
2019-08-03 15:03:33 +02:00
macro('hd', {
from: points.bottomLeft,
to: points.bottomRight,
2021-04-24 10:16:31 +02:00
y: points.bottomLeft.y + 15,
2019-08-03 15:03:33 +02:00
})
macro('vd', {
from: points.bottomRight,
to: points.topRight,
2021-04-24 10:16:31 +02:00
x: points.topRight.x + 15,
2019-08-03 15:03:33 +02:00
})
}
2019-08-03 15:03:33 +02:00
return part
}
2022-09-03 15:41:48 +02:00
export const pocketInterfacing = {
name: 'wahid.pocketInterfacing',
measurements: ['hips'],
options: {
pocketWidth,
pocketAngle,
weltHeight,
},
draft: wahidPocketInterfacing,
}