2022-09-04 11:37:23 -07:00
|
|
|
import { back } from './back.mjs'
|
|
|
|
|
|
|
|
function draftCarltonBelt (part) {
|
2021-08-30 11:40:16 +02:00
|
|
|
let { paperless, sa, snippets, Snippet, store, complete, points, macro, Point, paths, Path } =
|
|
|
|
part.shorthand()
|
2019-03-25 18:20:15 +01:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
let length = 1.6 * (store.get('cbToDart') + store.get('dartToSide'))
|
2020-02-01 15:59:44 +01:00
|
|
|
let width = store.get('beltWidth')
|
2019-03-25 18:20:15 +01:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
points.topLeft = new Point(0, 0)
|
|
|
|
points.topRight = new Point(length, 0)
|
|
|
|
points.bottomLeft = new Point(0, width)
|
|
|
|
points.bottomRight = new Point(length, width)
|
|
|
|
points.button = new Point(width / 2, width / 2)
|
|
|
|
macro('round', {
|
2019-03-25 18:20:15 +01:00
|
|
|
from: points.topRight,
|
|
|
|
to: points.bottomLeft,
|
|
|
|
via: points.topLeft,
|
2019-08-03 15:03:33 +02:00
|
|
|
prefix: 'roundTop',
|
|
|
|
radius: width / 4,
|
2021-04-24 10:16:31 +02:00
|
|
|
render: true,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('round', {
|
2019-03-25 18:20:15 +01:00
|
|
|
from: points.topLeft,
|
|
|
|
to: points.bottomRight,
|
|
|
|
via: points.bottomLeft,
|
2019-08-03 15:03:33 +02:00
|
|
|
prefix: 'roundBottom',
|
|
|
|
radius: width / 4,
|
2021-04-24 10:16:31 +02:00
|
|
|
render: true,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-03-25 18:20:15 +01:00
|
|
|
|
|
|
|
// Paths
|
|
|
|
paths.seam = new Path()
|
|
|
|
.move(points.roundTopStart)
|
|
|
|
.curve(points.roundTopCp1, points.roundTopCp2, points.roundTopEnd)
|
|
|
|
.line(points.roundBottomStart)
|
|
|
|
.curve(points.roundBottomCp1, points.roundBottomCp2, points.roundBottomEnd)
|
|
|
|
.line(points.bottomRight)
|
|
|
|
.line(points.topRight)
|
|
|
|
.line(points.roundTopStart)
|
|
|
|
.close()
|
2019-08-03 15:03:33 +02:00
|
|
|
.attr('class', 'fabric')
|
2019-03-25 18:20:15 +01:00
|
|
|
|
|
|
|
if (complete) {
|
2019-08-03 15:03:33 +02:00
|
|
|
snippets.button = new Snippet('button', points.button).attr('data-scale', 2)
|
|
|
|
points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2)
|
|
|
|
macro('title', {
|
2019-03-30 11:32:32 +01:00
|
|
|
at: points.title,
|
|
|
|
nr: 6,
|
2021-04-24 10:16:31 +02:00
|
|
|
title: 'belt',
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
points.logo = new Point(points.bottomRight.x * 0.75, points.bottomRight.y * 0.65)
|
|
|
|
snippets.logo = new Snippet('logo', points.logo)
|
2020-04-29 20:53:32 +02:00
|
|
|
snippets.waistNotch = new Snippet(
|
|
|
|
'notch',
|
|
|
|
points.bottomRight.shiftFractionTowards(points.topRight, 0.5)
|
|
|
|
)
|
2019-03-30 11:32:32 +01:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa')
|
2019-03-30 11:32:32 +01:00
|
|
|
|
|
|
|
if (paperless) {
|
2019-08-03 15:03:33 +02:00
|
|
|
macro('hd', {
|
2019-03-30 11:32:32 +01:00
|
|
|
from: points.roundBottomStart,
|
|
|
|
to: points.roundBottomEnd,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.roundBottomEnd.y + sa + 15,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-30 11:32:32 +01:00
|
|
|
from: points.roundBottomStart,
|
|
|
|
to: points.button,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.roundBottomEnd.y + sa + 30,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('hd', {
|
2019-03-30 11:32:32 +01:00
|
|
|
from: points.roundBottomStart,
|
|
|
|
to: points.bottomRight,
|
2021-04-24 10:16:31 +02:00
|
|
|
y: points.roundBottomEnd.y + sa + 45,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
|
|
|
macro('vd', {
|
2019-03-30 11:32:32 +01:00
|
|
|
from: points.bottomRight,
|
|
|
|
to: points.topRight,
|
2021-04-24 10:16:31 +02:00
|
|
|
x: points.topRight.x + sa + 15,
|
2019-08-03 15:03:33 +02:00
|
|
|
})
|
2019-03-30 11:32:32 +01:00
|
|
|
}
|
2019-03-25 18:20:15 +01:00
|
|
|
}
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return part
|
2019-03-25 18:20:15 +01:00
|
|
|
}
|
2022-09-04 11:37:23 -07:00
|
|
|
|
|
|
|
export const belt = {
|
|
|
|
name: 'carlton.belt',
|
|
|
|
after: back,
|
|
|
|
draft: draftCarltonBelt,
|
|
|
|
}
|