1
0
Fork 0
freesewing/designs/cornelius/src/zipperguard.mjs

89 lines
2 KiB
JavaScript
Raw Normal View History

2022-09-05 10:35:01 -07:00
import { front } from './front.mjs'
2022-09-11 14:02:00 +02:00
function draftCorneliusZipperguard({
Point,
Path,
points,
paths,
Snippet,
snippets,
complete,
sa,
store,
paperless,
macro,
part,
}) {
2021-10-20 13:03:27 -07:00
const cc = 0.551915024494 // circle constant
2022-01-19 16:26:12 +01:00
let halfInch = store.get('halfInch')
let flyWidth = store.get('flyWidth') * halfInch
let flyLength = store.get('flyLength')
2021-10-27 18:36:26 +02:00
2022-01-19 16:26:12 +01: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)
2021-10-20 13:03:27 -07:00
2022-01-19 16:26:12 +01:00
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
2022-01-19 16:26:12 +01:00
paths.seam2 = new Path().move(points.pD).line(points.pA).attr('class', 'fabric')
2021-10-27 18:36:26 +02:00
2022-01-19 16:26:12 +01:00
if (complete) {
macro('cutonfold', {
from: points.pD,
to: points.pA,
})
2021-10-27 18:36:26 +02:00
2022-01-19 16:26:12 +01: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
2022-01-19 16:26:12 +01: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-20 13:03:27 -07:00
}
2022-01-19 16:26:12 +01:00
}
2021-10-27 18:36:26 +02:00
2022-01-19 16:26:12 +01: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-20 13:03:27 -07:00
}
2021-10-27 18:36:26 +02:00
2022-01-19 16:26:12 +01:00
return part
}
2022-09-05 10:35:01 -07:00
export const zipperguard = {
name: 'cornelius.zipperguard',
after: front,
draft: draftCorneliusZipperguard,
}