1
0
Fork 0

chore(sven): Prepare for v3 beta

This commit is contained in:
Joost De Cock 2023-09-18 20:14:55 +02:00
parent 0becde35af
commit f3026d6466
7 changed files with 265 additions and 189 deletions

View file

@ -342,7 +342,7 @@
"design": "Joost De Cock",
"difficulty": 3,
"tags": ["tops"],
"techniques": []
"techniques": ["curvedSeam", "flatSleeve", "ribbing"]
},
"tamiko": {
"description": "A FreeSewing pattern for a zero-waste top",

View file

@ -8,7 +8,12 @@
"sleeve": "Sleeve",
"waistband": "Waistband"
},
"s": {},
"s": {
"cutCuff.t": "The cuff is not shown",
"cutCuff.d": "The **Cuff** (6) is a rectangular piece of ribbing fabric {{{ w }}} wide and {{{ l }}} long (this includes seam allowance). It is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part.",
"cutWaistband.t": "The waistband is not shown",
"cutWaistband.d": "The **Waistband** (4) is a rectangular piece of ribbing fabric {{{ w }}} wide and {{{ l }}} long (this includes seam allowance). It is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part."
},
"o": {
"hipsEase": {
"t": "Hips ease",
@ -18,6 +23,14 @@
"t": "Ribbing",
"d": "Whether to finish the hem and cuffs with ribbing or not."
},
"ribbingNo": {
"t": "Do not use ribbing",
"d": "Do not finish the hem and cuffs with ribbing but rather use a classic hem"
},
"ribbingYes": {
"t": "Use ribbing",
"d": "Finish the hem and cuffs with ribbing fabric"
},
"ribbingHeight": {
"t": "Ribbing height",
"d": "The height of the ribbing on cuffs and hem."

View file

@ -3,23 +3,51 @@ import { ribbing } from './frontback.mjs'
import { sleeve } from './sleeve.mjs'
function svenCuff(params) {
const { measurements, sa, points, complete, macro, options, part } = params
const { measurements, sa, points, macro, options, store, expand, units, part } = params
if (!options.ribbing) return part
const length = measurements.wrist * (1 + options.cuffEase) * (1 - options.ribbingStretch)
if (expand) store.flag.preset('expandIsOn')
else {
// Expand is on, do not draw the part but flag this to the user
store.flag.note({
msg: `sven:cutCuff`,
replace: {
w: units(
(measurements.hpsToWaistBack + measurements.waistToHips) * options.ribbingHeight + 2 * sa
),
l: units(length + 2 * sa),
},
suggest: {
text: 'flag:show',
icon: 'expand',
update: {
settings: ['expand', 1],
},
},
})
// Also hint about expand
store.flag.preset('expandIsOff')
return part.hide()
}
draftRibbing(params, length)
// Complete pattern?
if (complete) {
macro('title', {
at: points.title,
nr: 5,
title: 'cuff',
})
if (sa) {
// FIXME: Don't we need SA here?
}
}
/*
* Annotations
*/
// Cutlist
store.cutlist.setCut({ cut: 2, from: 'ribbing' })
// Title
macro('title', {
at: points.title,
nr: 5,
title: 'cuff',
align: 'center',
})
return part
}

View file

@ -9,8 +9,6 @@ function svenFrontBack({
points,
Path,
paths,
complete,
paperless,
macro,
options,
part,
@ -55,59 +53,104 @@ function svenFrontBack({
paths.seam.attr('class', 'fabric')
// Seam allowance
if (complete) {
if (sa) {
paths.sa = paths.hemBase.offset(sa * (options.ribbing ? 1 : 3)).join(paths.saBase.offset(sa))
if (front) paths.sa.line(points.cfNeck).move(points.cfHem)
else paths.sa.line(points.cbNeck).move(points.cbHem)
paths.sa.line(paths.sa.start())
paths.sa.attr('class', 'fabric sa')
}
if (sa) {
paths.sa = paths.hemBase.offset(sa * (options.ribbing ? 1 : 3)).join(paths.saBase.offset(sa))
if (front) paths.sa.line(points.cfNeck).move(points.cfHem)
else paths.sa.line(points.cbNeck).move(points.cbHem)
paths.sa.line(paths.sa.start())
paths.sa.attr('class', 'fabric sa')
}
// Paperless
if (paperless) {
macro('pd', {
path: new Path()
.move(points.armhole)
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
d: sa + 15,
})
macro('pd', {
path: new Path()
.move(points.armholePitch)
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
d: -15,
})
macro('vd', {
from: points.hips,
to: points.waist,
x: points.hips.x + sa + 15,
})
macro('vd', {
from: points.hips,
to: points.armhole,
x: points.hips.x + sa + 30,
})
macro('vd', {
from: points.hips,
to: points.armholePitch,
x: points.hips.x + sa + 45,
})
macro('vd', {
from: points.hips,
to: points.shoulder,
x: points.hips.x + sa + 60,
})
macro('vd', {
from: points.hips,
to: points.neck,
x: points.hips.x + sa + 75,
})
macro('ld', { from: points.neck, to: points.shoulder, d: sa + 15 })
}
/*
* Annotations
*/
// Dimensions
macro('rmad')
macro('pd', {
id: 'lArmhole',
path: new Path()
.move(points.armhole)
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
d: sa + 15,
})
macro('pd', {
id: 'lShoulderToArmholePitch',
path: new Path()
.move(points.armholePitch)
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
d: -15,
})
macro('vd', {
id: 'hHemToHips',
from: points.hem,
to: points.waist,
x: points.hips.x + sa + 15,
})
macro('vd', {
id: 'hHemToArmhole',
from: points.hem,
to: points.armhole,
x: points.hips.x + sa + 30,
})
macro('vd', {
id: 'hHemToArmholePitch',
from: points.hem,
to: points.armholePitch,
x: points.hips.x + sa + 45,
})
macro('vd', {
id: 'hHemToShoulder',
from: points.hem,
to: points.shoulder,
x: points.hips.x + sa + 60,
})
macro('vd', {
id: 'hFull',
from: points.hem,
to: points.neck,
x: points.hips.x + sa + 75,
})
macro('ld', { from: points.neck, to: points.shoulder, d: sa + 15, id: 'lShoulderSeam' })
points.cxHem = new Point(0, points.hem.y)
points.cxNeck = points.cbNeck ? points.cbNeck.copy() : points.cfNeck.copy()
macro('hd', {
id: 'wAtHem',
from: points.cxHem,
to: points.hem,
y: points.hem.y + sa + 15,
})
macro('hd', {
id: 'wAtArmhole',
from: points.cxHem,
to: points.armhole,
y: points.hem.y + sa + 30,
})
macro('hd', {
id: 'wNeckToHps',
from: points.cxNeck,
to: points.s3CollarSplit,
y: points.s3CollarSplit.y - sa - 15,
})
macro('hd', {
id: 'wNeckToShoulder',
from: points.cxNeck,
to: points.s3ArmholeSplit,
y: points.s3CollarSplit.y - sa - 15,
})
macro('hd', {
id: 'wNeckToArmhole',
from: points.cxNeck,
to: points.armhole,
y: points.s3CollarSplit.y - sa - 45,
})
macro('hd', {
id: 'wArmholeToPitch',
from: points.armholePitch,
to: points.armhole,
y: points.armhole.y,
})
return part
}

View file

@ -1,82 +1,37 @@
export const draftRibbing = function (
{
store,
measurements,
options,
points,
paths,
Path,
Point,
sa,
complete,
paperless,
macro,
units,
part,
},
{ store, measurements, options, points, paths, Path, Point, sa, macro, units, part },
length
) {
let height = (measurements.hpsToWaistBack + measurements.waistToHips) * options.ribbingHeight
const height = (measurements.hpsToWaistBack + measurements.waistToHips) * options.ribbingHeight
if (part.context.settings.sample) store.set('ribbingHeight', height)
else store.setIfUnset('ribbingHeight', height)
let gap = 25
let lead = 50
if (length < 125) lead = length / 3
points.topLeft = new Point(0, 0)
points.topRight = new Point(height * 2, 0)
points.leftGapStart = new Point(0, lead)
points.rightGapEnd = new Point(points.topRight.x, lead)
points.leftGapEnd = new Point(0, lead + gap)
points.rightGapStart = new Point(points.topRight.x, lead + gap)
points.bottomLeft = new Point(0, gap + 2 * lead)
points.bottomRight = new Point(points.topRight.x, gap + 2 * lead)
points.bottomLeft = new Point(0, length)
points.bottomRight = new Point(height * 2, length)
paths.seam = new Path()
.move(points.rightGapEnd)
.line(points.topRight)
.line(points.topLeft)
.line(points.leftGapStart)
.move(points.leftGapEnd)
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.rightGapStart)
.line(points.topRight)
.line(points.topLeft)
.close()
.attr('class', 'various')
if (sa) paths.sa = paths.seam.offset(sa).addClass('various sa')
paths.hint = new Path()
.move(points.leftGapStart)
.line(points.leftGapEnd)
.move(points.rightGapStart)
.line(points.rightGapEnd)
.attr('class', 'various dashed')
points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2)
if (complete) {
points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2)
if (sa) {
paths.sa = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topLeft)
.close()
.offset(sa)
.attr('class', 'various sa')
}
}
if (paperless) {
macro('vd', {
from: points.bottomRight,
to: points.topRight,
x: points.topRight.x + sa + 15,
text: units(length),
})
macro('hd', {
from: points.topLeft,
to: points.topRight,
y: points.topRight.y - sa - 15,
})
}
macro('vd', {
from: points.bottomRight,
to: points.topRight,
x: points.topRight.x + sa + 15,
text: units(length),
})
macro('hd', {
from: points.topLeft,
to: points.topRight,
y: points.topRight.y - sa - 15,
})
}

View file

@ -2,7 +2,7 @@ import { sleeve as brianSleeve } from '@freesewing/brian'
import { ribbing, front, back } from './frontback.mjs'
import { hidePresets } from '@freesewing/core'
function svenSleeve({ store, sa, points, paths, Path, complete, paperless, macro, options, part }) {
function svenSleeve({ store, sa, points, paths, Path, macro, options, part }) {
if (options.ribbing) {
const ribbingHeight = store.get('ribbingHeight')
points.wristLeft = points.wristLeft.shift(90, ribbingHeight)
@ -19,53 +19,59 @@ function svenSleeve({ store, sa, points, paths, Path, complete, paperless, macro
.close()
.attr('class', 'fabric')
// Complete pattern?
if (complete) {
macro('grainline', {
from: points.centerWrist,
to: points.grainlineTo,
})
if (sa) {
paths.saBase = new Path()
.move(points.wristRight)
.line(points.bicepsRight)
.join(paths.sleevecap)
.line(points.wristLeft)
paths.hemBase = new Path().move(points.wristLeft).line(points.wristRight)
paths.saBase.hide()
paths.hemBase.hide()
paths.sa = paths.saBase.offset(sa).join(paths.hemBase.offset(sa * (options.ribbing ? 1 : 3)))
paths.sa.line(paths.sa.start()).close().attr('class', 'fabric sa')
}
if (sa) {
paths.saBase = new Path()
.move(points.wristRight)
.line(points.bicepsRight)
.join(paths.sleevecap)
.line(points.wristLeft)
paths.hemBase = new Path().move(points.wristLeft).line(points.wristRight)
paths.saBase.hide()
paths.hemBase.hide()
paths.sa = paths.saBase.offset(sa).join(paths.hemBase.offset(sa * (options.ribbing ? 1 : 3)))
paths.sa.line(paths.sa.start()).close().attr('class', 'fabric sa')
}
// Paperless?
if (paperless) {
macro('vd', {
from: points.wristLeft,
to: points.bicepsLeft,
x: points.bicepsLeft.x - sa - 15,
})
macro('vd', {
from: points.wristLeft,
to: points.sleeveTip,
x: points.bicepsLeft.x - sa - 30,
})
macro('hd', {
from: points.bicepsLeft,
to: points.bicepsRight,
y: points.sleeveTip.y - sa - 30,
})
macro('hd', {
from: points.wristLeft,
to: points.wristRight,
y: points.wristLeft.y + sa * (options.ribbing ? 1 : 3) + 15,
})
macro('pd', {
path: paths.sleevecap.reverse(),
d: -1 * sa - 15,
})
}
/*
* Annotations
*/
// Grainline
macro('grainline', {
from: points.centerWrist,
to: points.sleeveTop,
})
// Dimensions
macro('rmad')
macro('vd', {
id: 'hWristToArmhole',
from: points.wristLeft,
to: points.bicepsLeft,
x: points.bicepsLeft.x - sa - 15,
})
macro('vd', {
id: 'hFull',
from: points.wristLeft,
to: points.sleeveTip,
x: points.bicepsLeft.x - sa - 30,
})
macro('hd', {
id: 'wFull',
from: points.bicepsLeft,
to: points.bicepsRight,
y: points.sleeveTip.y - sa - 30,
})
macro('hd', {
id: 'wCuff',
from: points.wristLeft,
to: points.wristRight,
y: points.wristLeft.y + sa * (options.ribbing ? 1 : 3) + 15,
})
macro('pd', {
id: 'lSleevecap',
path: paths.sleevecap.reverse(),
d: -1 * sa - 15,
})
return part
}

View file

@ -3,21 +3,52 @@ import { ribbing, hipsEase } from './frontback.mjs'
import { ribbingStretch } from './cuff.mjs'
function svenWaistband(params) {
const { measurements, points, complete, macro, options, part } = params
const { measurements, points, macro, options, store, expand, units, sa, part } = params
if (!options.ribbing) return part
let length = measurements.hips * (1 + options.hipsEase) * (1 - options.ribbingStretch)
const length = measurements.hips * (1 + options.hipsEase) * (1 - options.ribbingStretch)
if (expand) store.flag.preset('expandIsOn')
else {
// Expand is on, do not draw the part but flag this to the user
store.flag.note({
msg: `sven:cutWaistband`,
replace: {
w: units(
(measurements.hpsToWaistBack + measurements.waistToHips) * options.ribbingHeight + 2 * sa
),
l: units(length + 2 * sa),
},
suggest: {
text: 'flag:show',
icon: 'expand',
update: {
settings: ['expand', 1],
},
},
})
// Also hint about expand
store.flag.preset('expandIsOff')
return part.hide()
}
draftRibbing(params, length)
// Complete pattern?
if (complete) {
macro('title', {
at: points.title,
nr: 4,
title: 'waistband',
})
}
/*
* Annotations
*/
// Cutlist
store.cutlist.setCut({ cut: 2, from: 'ribbing' })
// Title
macro('title', {
at: points.title,
nr: 4,
title: 'waistband',
align: 'center',
})
return part
}