1
0
Fork 0
freesewing/designs/yuri/src/gusset.mjs

96 lines
2 KiB
JavaScript
Raw Normal View History

import { back } from './back.mjs'
2022-09-11 07:02:12 -07:00
function yuriGusset({
Point,
Path,
points,
paths,
Snippet,
snippets,
complete,
sa,
paperless,
macro,
store,
part,
}) {
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')
2021-11-13 14:08:10 +01:00
paths.seam = paths.hat.join(paths.curve).close()
2021-07-25 19:56:42 +02:00
// 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) {
paths.saBase = new Path().move(points.right).line(points.top).hide()
paths.sa = paths.curve
.offset(3 * sa)
.join(paths.saBase.offset(sa))
.line(points.top)
.close()
2022-05-31 15:56:25 +02:00
.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
}
export const gusset = {
name: 'yuri.gusset',
after: back,
draft: yuriGusset,
}