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", "design": "Joost De Cock",
"difficulty": 3, "difficulty": 3,
"tags": ["tops"], "tags": ["tops"],
"techniques": [] "techniques": ["curvedSeam", "flatSleeve", "ribbing"]
}, },
"tamiko": { "tamiko": {
"description": "A FreeSewing pattern for a zero-waste top", "description": "A FreeSewing pattern for a zero-waste top",

View file

@ -8,7 +8,12 @@
"sleeve": "Sleeve", "sleeve": "Sleeve",
"waistband": "Waistband" "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": { "o": {
"hipsEase": { "hipsEase": {
"t": "Hips ease", "t": "Hips ease",
@ -18,6 +23,14 @@
"t": "Ribbing", "t": "Ribbing",
"d": "Whether to finish the hem and cuffs with ribbing or not." "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": { "ribbingHeight": {
"t": "Ribbing height", "t": "Ribbing height",
"d": "The height of the ribbing on cuffs and hem." "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' import { sleeve } from './sleeve.mjs'
function svenCuff(params) { 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 if (!options.ribbing) return part
const length = measurements.wrist * (1 + options.cuffEase) * (1 - options.ribbingStretch) 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) draftRibbing(params, length)
// Complete pattern? /*
if (complete) { * Annotations
*/
// Cutlist
store.cutlist.setCut({ cut: 2, from: 'ribbing' })
// Title
macro('title', { macro('title', {
at: points.title, at: points.title,
nr: 5, nr: 5,
title: 'cuff', title: 'cuff',
align: 'center',
}) })
if (sa) {
// FIXME: Don't we need SA here?
}
}
return part return part
} }

View file

@ -9,8 +9,6 @@ function svenFrontBack({
points, points,
Path, Path,
paths, paths,
complete,
paperless,
macro, macro,
options, options,
part, part,
@ -55,7 +53,6 @@ function svenFrontBack({
paths.seam.attr('class', 'fabric') paths.seam.attr('class', 'fabric')
// Seam allowance // Seam allowance
if (complete) {
if (sa) { if (sa) {
paths.sa = paths.hemBase.offset(sa * (options.ribbing ? 1 : 3)).join(paths.saBase.offset(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) if (front) paths.sa.line(points.cfNeck).move(points.cfHem)
@ -63,11 +60,14 @@ function svenFrontBack({
paths.sa.line(paths.sa.start()) paths.sa.line(paths.sa.start())
paths.sa.attr('class', 'fabric sa') paths.sa.attr('class', 'fabric sa')
} }
}
// Paperless /*
if (paperless) { * Annotations
*/
// Dimensions
macro('rmad')
macro('pd', { macro('pd', {
id: 'lArmhole',
path: new Path() path: new Path()
.move(points.armhole) .move(points.armhole)
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow) .curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
@ -76,38 +76,81 @@ function svenFrontBack({
d: sa + 15, d: sa + 15,
}) })
macro('pd', { macro('pd', {
id: 'lShoulderToArmholePitch',
path: new Path() path: new Path()
.move(points.armholePitch) .move(points.armholePitch)
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder), .curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
d: -15, d: -15,
}) })
macro('vd', { macro('vd', {
from: points.hips, id: 'hHemToHips',
from: points.hem,
to: points.waist, to: points.waist,
x: points.hips.x + sa + 15, x: points.hips.x + sa + 15,
}) })
macro('vd', { macro('vd', {
from: points.hips, id: 'hHemToArmhole',
from: points.hem,
to: points.armhole, to: points.armhole,
x: points.hips.x + sa + 30, x: points.hips.x + sa + 30,
}) })
macro('vd', { macro('vd', {
from: points.hips, id: 'hHemToArmholePitch',
from: points.hem,
to: points.armholePitch, to: points.armholePitch,
x: points.hips.x + sa + 45, x: points.hips.x + sa + 45,
}) })
macro('vd', { macro('vd', {
from: points.hips, id: 'hHemToShoulder',
from: points.hem,
to: points.shoulder, to: points.shoulder,
x: points.hips.x + sa + 60, x: points.hips.x + sa + 60,
}) })
macro('vd', { macro('vd', {
from: points.hips, id: 'hFull',
from: points.hem,
to: points.neck, to: points.neck,
x: points.hips.x + sa + 75, x: points.hips.x + sa + 75,
}) })
macro('ld', { from: points.neck, to: points.shoulder, d: sa + 15 }) 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 return part
} }

View file

@ -1,72 +1,28 @@
export const draftRibbing = function ( export const draftRibbing = function (
{ { store, measurements, options, points, paths, Path, Point, sa, macro, units, part },
store,
measurements,
options,
points,
paths,
Path,
Point,
sa,
complete,
paperless,
macro,
units,
part,
},
length 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) if (part.context.settings.sample) store.set('ribbingHeight', height)
else store.setIfUnset('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.topLeft = new Point(0, 0)
points.topRight = new Point(height * 2, 0) points.topRight = new Point(height * 2, 0)
points.leftGapStart = new Point(0, lead) points.bottomLeft = new Point(0, length)
points.rightGapEnd = new Point(points.topRight.x, lead) points.bottomRight = new Point(height * 2, length)
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)
paths.seam = new Path() paths.seam = new Path()
.move(points.rightGapEnd)
.line(points.topRight)
.line(points.topLeft)
.line(points.leftGapStart)
.move(points.leftGapEnd)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.rightGapStart)
.attr('class', 'various')
paths.hint = new Path()
.move(points.leftGapStart)
.line(points.leftGapEnd)
.move(points.rightGapStart)
.line(points.rightGapEnd)
.attr('class', 'various dashed')
if (complete) {
points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2)
if (sa) {
paths.sa = new Path()
.move(points.topLeft) .move(points.topLeft)
.line(points.bottomLeft) .line(points.bottomLeft)
.line(points.bottomRight) .line(points.bottomRight)
.line(points.topRight) .line(points.topRight)
.line(points.topLeft) .line(points.topLeft)
.close() .close()
.offset(sa) .attr('class', 'various')
.attr('class', 'various sa') if (sa) paths.sa = paths.seam.offset(sa).addClass('various sa')
}
} points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2)
if (paperless) {
macro('vd', { macro('vd', {
from: points.bottomRight, from: points.bottomRight,
to: points.topRight, to: points.topRight,
@ -78,5 +34,4 @@ export const draftRibbing = function (
to: points.topRight, to: points.topRight,
y: points.topRight.y - sa - 15, 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 { ribbing, front, back } from './frontback.mjs'
import { hidePresets } from '@freesewing/core' 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) { if (options.ribbing) {
const ribbingHeight = store.get('ribbingHeight') const ribbingHeight = store.get('ribbingHeight')
points.wristLeft = points.wristLeft.shift(90, ribbingHeight) points.wristLeft = points.wristLeft.shift(90, ribbingHeight)
@ -19,12 +19,6 @@ function svenSleeve({ store, sa, points, paths, Path, complete, paperless, macro
.close() .close()
.attr('class', 'fabric') .attr('class', 'fabric')
// Complete pattern?
if (complete) {
macro('grainline', {
from: points.centerWrist,
to: points.grainlineTo,
})
if (sa) { if (sa) {
paths.saBase = new Path() paths.saBase = new Path()
.move(points.wristRight) .move(points.wristRight)
@ -37,35 +31,47 @@ function svenSleeve({ store, sa, points, paths, Path, complete, paperless, macro
paths.sa = paths.saBase.offset(sa).join(paths.hemBase.offset(sa * (options.ribbing ? 1 : 3))) 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') paths.sa.line(paths.sa.start()).close().attr('class', 'fabric sa')
} }
}
// Paperless? /*
if (paperless) { * Annotations
*/
// Grainline
macro('grainline', {
from: points.centerWrist,
to: points.sleeveTop,
})
// Dimensions
macro('rmad')
macro('vd', { macro('vd', {
id: 'hWristToArmhole',
from: points.wristLeft, from: points.wristLeft,
to: points.bicepsLeft, to: points.bicepsLeft,
x: points.bicepsLeft.x - sa - 15, x: points.bicepsLeft.x - sa - 15,
}) })
macro('vd', { macro('vd', {
id: 'hFull',
from: points.wristLeft, from: points.wristLeft,
to: points.sleeveTip, to: points.sleeveTip,
x: points.bicepsLeft.x - sa - 30, x: points.bicepsLeft.x - sa - 30,
}) })
macro('hd', { macro('hd', {
id: 'wFull',
from: points.bicepsLeft, from: points.bicepsLeft,
to: points.bicepsRight, to: points.bicepsRight,
y: points.sleeveTip.y - sa - 30, y: points.sleeveTip.y - sa - 30,
}) })
macro('hd', { macro('hd', {
id: 'wCuff',
from: points.wristLeft, from: points.wristLeft,
to: points.wristRight, to: points.wristRight,
y: points.wristLeft.y + sa * (options.ribbing ? 1 : 3) + 15, y: points.wristLeft.y + sa * (options.ribbing ? 1 : 3) + 15,
}) })
macro('pd', { macro('pd', {
id: 'lSleevecap',
path: paths.sleevecap.reverse(), path: paths.sleevecap.reverse(),
d: -1 * sa - 15, d: -1 * sa - 15,
}) })
}
return part return part
} }

View file

@ -3,21 +3,52 @@ import { ribbing, hipsEase } from './frontback.mjs'
import { ribbingStretch } from './cuff.mjs' import { ribbingStretch } from './cuff.mjs'
function svenWaistband(params) { 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 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) draftRibbing(params, length)
// Complete pattern? /*
if (complete) { * Annotations
*/
// Cutlist
store.cutlist.setCut({ cut: 2, from: 'ribbing' })
// Title
macro('title', { macro('title', {
at: points.title, at: points.title,
nr: 4, nr: 4,
title: 'waistband', title: 'waistband',
align: 'center',
}) })
}
return part return part
} }