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
macro('title', { */
at: points.title, // Cutlist
nr: 5, store.cutlist.setCut({ cut: 2, from: 'ribbing' })
title: 'cuff',
}) // Title
if (sa) { macro('title', {
// FIXME: Don't we need SA here? at: points.title,
} nr: 5,
} title: 'cuff',
align: 'center',
})
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,59 +53,104 @@ 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) else paths.sa.line(points.cbNeck).move(points.cbHem)
else paths.sa.line(points.cbNeck).move(points.cbHem) 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
macro('pd', { */
path: new Path() // Dimensions
.move(points.armhole) macro('rmad')
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow) macro('pd', {
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch) id: 'lArmhole',
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder), path: new Path()
d: sa + 15, .move(points.armhole)
}) .curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
macro('pd', { .curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
path: new Path() .curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
.move(points.armholePitch) d: sa + 15,
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder), })
d: -15, macro('pd', {
}) id: 'lShoulderToArmholePitch',
macro('vd', { path: new Path()
from: points.hips, .move(points.armholePitch)
to: points.waist, .curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
x: points.hips.x + sa + 15, d: -15,
}) })
macro('vd', { macro('vd', {
from: points.hips, id: 'hHemToHips',
to: points.armhole, from: points.hem,
x: points.hips.x + sa + 30, to: points.waist,
}) x: points.hips.x + sa + 15,
macro('vd', { })
from: points.hips, macro('vd', {
to: points.armholePitch, id: 'hHemToArmhole',
x: points.hips.x + sa + 45, from: points.hem,
}) to: points.armhole,
macro('vd', { x: points.hips.x + sa + 30,
from: points.hips, })
to: points.shoulder, macro('vd', {
x: points.hips.x + sa + 60, id: 'hHemToArmholePitch',
}) from: points.hem,
macro('vd', { to: points.armholePitch,
from: points.hips, x: points.hips.x + sa + 45,
to: points.neck, })
x: points.hips.x + sa + 75, macro('vd', {
}) id: 'hHemToShoulder',
macro('ld', { from: points.neck, to: points.shoulder, d: sa + 15 }) 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 return part
} }

View file

@ -1,82 +1,37 @@
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) .move(points.topLeft)
.line(points.topRight)
.line(points.topLeft)
.line(points.leftGapStart)
.move(points.leftGapEnd)
.line(points.bottomLeft) .line(points.bottomLeft)
.line(points.bottomRight) .line(points.bottomRight)
.line(points.rightGapStart) .line(points.topRight)
.line(points.topLeft)
.close()
.attr('class', 'various') .attr('class', 'various')
if (sa) paths.sa = paths.seam.offset(sa).addClass('various sa')
paths.hint = new Path() points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2)
.move(points.leftGapStart)
.line(points.leftGapEnd)
.move(points.rightGapStart)
.line(points.rightGapEnd)
.attr('class', 'various dashed')
if (complete) { macro('vd', {
points.title = new Point(points.bottomRight.x / 2, points.bottomRight.y / 2) from: points.bottomRight,
if (sa) { to: points.topRight,
paths.sa = new Path() x: points.topRight.x + sa + 15,
.move(points.topLeft) text: units(length),
.line(points.bottomLeft) })
.line(points.bottomRight) macro('hd', {
.line(points.topRight) from: points.topLeft,
.line(points.topLeft) to: points.topRight,
.close() y: points.topRight.y - sa - 15,
.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,
})
}
} }

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,53 +19,59 @@ function svenSleeve({ store, sa, points, paths, Path, complete, paperless, macro
.close() .close()
.attr('class', 'fabric') .attr('class', 'fabric')
// Complete pattern? if (sa) {
if (complete) { paths.saBase = new Path()
macro('grainline', { .move(points.wristRight)
from: points.centerWrist, .line(points.bicepsRight)
to: points.grainlineTo, .join(paths.sleevecap)
}) .line(points.wristLeft)
if (sa) { paths.hemBase = new Path().move(points.wristLeft).line(points.wristRight)
paths.saBase = new Path() paths.saBase.hide()
.move(points.wristRight) paths.hemBase.hide()
.line(points.bicepsRight) paths.sa = paths.saBase.offset(sa).join(paths.hemBase.offset(sa * (options.ribbing ? 1 : 3)))
.join(paths.sleevecap) paths.sa.line(paths.sa.start()).close().attr('class', 'fabric sa')
.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) { * Annotations
macro('vd', { */
from: points.wristLeft, // Grainline
to: points.bicepsLeft, macro('grainline', {
x: points.bicepsLeft.x - sa - 15, from: points.centerWrist,
}) to: points.sleeveTop,
macro('vd', { })
from: points.wristLeft,
to: points.sleeveTip, // Dimensions
x: points.bicepsLeft.x - sa - 30, macro('rmad')
}) macro('vd', {
macro('hd', { id: 'hWristToArmhole',
from: points.bicepsLeft, from: points.wristLeft,
to: points.bicepsRight, to: points.bicepsLeft,
y: points.sleeveTip.y - sa - 30, x: points.bicepsLeft.x - sa - 15,
}) })
macro('hd', { macro('vd', {
from: points.wristLeft, id: 'hFull',
to: points.wristRight, from: points.wristLeft,
y: points.wristLeft.y + sa * (options.ribbing ? 1 : 3) + 15, to: points.sleeveTip,
}) x: points.bicepsLeft.x - sa - 30,
macro('pd', { })
path: paths.sleevecap.reverse(), macro('hd', {
d: -1 * sa - 15, 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 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
macro('title', { */
at: points.title, // Cutlist
nr: 4, store.cutlist.setCut({ cut: 2, from: 'ribbing' })
title: 'waistband',
}) // Title
} macro('title', {
at: points.title,
nr: 4,
title: 'waistband',
align: 'center',
})
return part return part
} }