1
0
Fork 0
freesewing/packages/cornelius/src/zipperguard.js

72 lines
1.9 KiB
JavaScript
Raw Normal View History

2021-10-20 13:03:27 -07:00
export default function (part) {
let { Point, Path, points, paths, Snippet, snippets, complete, sa, store, paperless, macro } =
part.shorthand()
2021-10-27 18:36:26 +02:00
2021-10-20 13:03:27 -07:00
const cc = 0.551915024494 // circle constant
let halfInch = store.get('halfInch')
let flyWidth = store.get('flyWidth') *halfInch
let flyLength = store.get('flyLength')
2021-10-27 18:36:26 +02:00
2021-10-20 13:03:27 -07:00
points.pA = new Point(0, 0)
points.pB = points.pA.shift(180, flyWidth)
points.pC = points.pB.shift(270, flyLength -flyWidth)
points.pD = points.pA.shift(270, flyLength)
points.pDcpC = points.pD.shift(180, flyWidth * cc)
points.pCcpD = points.pC.shift(270, flyWidth * cc)
paths.seam = new Path()
.move(points.pA)
.line(points.pB)
.line(points.pC)
.curve(points.pCcpD, points.pDcpC, points.pD)
.attr('class', 'fabric')
2021-10-27 18:36:26 +02:00
2021-10-20 13:03:27 -07:00
paths.seam2 = new Path().move(points.pD).line(points.pA).attr('class', 'fabric')
2021-10-27 18:36:26 +02:00
2021-10-20 13:03:27 -07:00
if (complete) {
macro('cutonfold', {
from: points.pD,
to: points.pA,
})
2021-10-27 18:36:26 +02:00
2021-10-20 13:03:27 -07:00
points.logo = points.pA.shiftFractionTowards(points.pC, 0.5)
snippets.logo = new Snippet('logo', points.logo)
points.title = points.logo.shift(90, 70)
macro('title', {
nr: 4,
at: points.title,
title: 'ZipperGuard',
})
points.__titleNr.attr('data-text-class', 'center')
points.__titleName.attr('data-text-class', 'center')
points.__titlePattern.attr('data-text-class', 'center')
2021-10-27 18:36:26 +02:00
2021-10-20 13:03:27 -07:00
if (sa) {
paths.sa = new Path()
.move(points.pA)
.line(points.pA.shift(90, sa))
.join(paths.seam.offset(sa))
.line(points.pD)
.attr('class', 'fabric sa')
}
}
2021-10-27 18:36:26 +02:00
2021-10-20 13:03:27 -07:00
// Paperless?
if (paperless) {
macro('hd', {
from: points.pB,
to: points.pA,
y: points.pA.y - sa - 15,
})
macro('vd', {
from: points.pA,
to: points.pD,
x: points.pA.x + 15,
})
}
2021-10-27 18:36:26 +02:00
2021-10-20 13:03:27 -07:00
return part
}
2021-10-27 18:36:26 +02:00