1
0
Fork 0
freesewing/packages/yuri/src/gusset.js

75 lines
1.8 KiB
JavaScript
Raw Normal View History

2021-07-25 19:56:42 +02:00
export default function (part) {
2021-09-04 13:27:13 +02:00
const { Point, Path, points, paths, Snippet, snippets, complete, sa, paperless, macro, store } =
part.shorthand()
2021-07-25 19:56:42 +02:00
const w = store.get('gussetLength')
points.top = new Point(0, 0)
points.bottom = new Point(0, w)
2021-07-27 20:26:12 +02:00
points.right = points.bottom.rotate(36.0, points.top)
2021-09-04 13:27:13 +02:00
points.cp1 = new Point(0, (w * 6) / 5).rotate(90, points.bottom)
points.cp2 = new Point(points.right.x, (points.right.y * 6) / 5).rotate(-60, points.right)
points.title = new Point(0, (2 * w) / 3).rotate(15, points.top)
2021-07-25 19:56:42 +02:00
paths.hat = new Path()
.move(points.right)
.line(points.top)
.line(points.bottom)
.attr('class', 'fabric')
paths.curve = new Path()
.move(points.bottom)
.curve(points.cp1, points.cp2, points.right)
.attr('class', 'fabric')
paths.seam = paths.hat.join(paths.curve)
// Complete?
if (complete) {
macro('cutonfold', {
from: new Point(points.top.x, points.top.y + 50),
to: points.bottom,
2021-09-04 13:27:13 +02:00
grainline: true,
2021-07-25 19:56:42 +02:00
})
macro('title', {
at: points.title,
nr: 4,
2021-09-04 13:27:13 +02:00
title: 'gusset',
2021-07-25 19:56:42 +02:00
})
points.logo = points.title.shift(-75, 100)
snippets.logo = new Snippet('logo', points.logo)
if (sa) {
2021-09-04 13:27:13 +02:00
paths.sa = paths.hat
.offset(sa)
.join(paths.curve.offset(3 * sa))
.attr('class', 'fabric sa')
2021-07-25 19:56:42 +02:00
}
}
// Paperless?
if (paperless) {
2021-07-25 21:18:33 +02:00
macro('vd', {
from: points.top,
to: points.bottom,
2021-09-04 13:27:13 +02:00
x: points.top.x - sa - 15,
2021-07-25 19:56:42 +02:00
})
macro('vd', {
2021-07-25 21:18:33 +02:00
from: new Point(0, points.right.y),
to: points.bottom,
2021-09-04 13:27:13 +02:00
x: 20,
2021-07-25 21:18:33 +02:00
})
macro('ld', {
from: points.top,
to: points.right,
2021-09-04 13:27:13 +02:00
d: sa + 15,
2021-07-25 21:18:33 +02:00
})
macro('hd', {
from: new Point(0, points.right),
to: points.right,
2021-09-04 13:27:13 +02:00
y: points.right.y,
2021-07-25 19:56:42 +02:00
})
}
return part
}