diff --git a/config/software/designs.json b/config/software/designs.json index c834f74233b..6e7e775d8dd 100644 --- a/config/software/designs.json +++ b/config/software/designs.json @@ -382,7 +382,7 @@ "design": "Joost De Cock", "difficulty": 2, "tags": ["accessories"], - "techniques": [] + "techniques": ["precision", "lining"] }, "tutorial": { "description": "A FreeSewing pattern for a baby bib that's used in our tutorial", diff --git a/designs/trayvon/i18n/en.json b/designs/trayvon/i18n/en.json index 916341a7f00..697bda1e148 100644 --- a/designs/trayvon/i18n/en.json +++ b/designs/trayvon/i18n/en.json @@ -10,7 +10,10 @@ "liningTail": "Lining tail", "liningTip": "Lining tip" }, - "s": {}, + "s": { + "cutLoop.t": "The loop is not shown", + "cutLoop.d": "The **Loop** is a rectangular piece of fabric {{{ width }}} wide and {{{ length }}} long (this part does not use seam allowance). It is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part." + }, "o": { "tipWidth": { "t": "Tip width", diff --git a/designs/trayvon/src/fabric.mjs b/designs/trayvon/src/fabric.mjs index ce5096173f8..085fe613136 100644 --- a/designs/trayvon/src/fabric.mjs +++ b/designs/trayvon/src/fabric.mjs @@ -7,106 +7,98 @@ import { } from './shared.mjs' function trayvonFabricTail(params) { - const { Path, complete, macro, paths, points, paperless, sa, store, absoluteOptions } = params + const { Path, complete, macro, paths, points, sa, store, absoluteOptions } = params calculateHelpers(params) draftTieShape(params, store.get('backTip') * 2.5, absoluteOptions.knotWidth * 2.5, true) - paths.seam.attributes.add('class', 'fabric') + paths.seam.addClass('fabric') + if (sa) seamAllowance(params, 'fabric') + /* + * Annotations + */ + // Cutlist store.cutlist.addCut({ cut: 1 }) - // Complete pattern? - if (complete) { - macro('title', { - at: points.title, - nr: 4, - title: 'fabricTail', - rotation: -90, - }) + // Title + macro('title', { + at: points.title, + nr: 4, + title: 'fabricTail', + rotation: -90, + }) - if (sa) seamAllowance(params, 'fabric') - } - - // Paperless? - if (paperless) { - tieShapeDimensions(params) - macro('ld', { - from: points.tip, - to: points.notch1, - d: absoluteOptions.tipWidth / -2.5, - }) - macro('ld', { - from: points.notch2, - to: points.tip, - d: absoluteOptions.tipWidth / -2.5, - }) + // Dimensions + tieShapeDimensions(params) + macro('ld', { + id: 'lTipToNotch1', + from: points.tip, + to: points.notch1, + d: absoluteOptions.tipWidth / -2.5, + }) + macro('ld', { + id: 'lTipToNotch2', + from: points.notch2, + to: points.tip, + d: absoluteOptions.tipWidth / -2.5, + }) + if (complete) paths.n45 = new Path() .move(points.midLeft) .line(points.midRight) - .attr('class', 'hidden') - .attr('data-text', '45°') - .attr('data-text-class', 'center') - } + .addClass('hidden') + .addText('45°', 'center') return params.part } function trayvonFabricTip(params) { - const { - Path, - Snippet, - complete, - macro, - paths, - paperless, - points, - sa, - snippets, - absoluteOptions, - store, - } = params + const { Path, Snippet, complete, macro, paths, points, sa, snippets, absoluteOptions, store } = + params calculateHelpers(params) draftTieShape(params, absoluteOptions.tipWidth * 2.5, absoluteOptions.knotWidth * 2.5, true) - paths.seam.attributes.add('class', 'fabric') + paths.seam.addClass('fabric') + if (sa) seamAllowance(params, 'fabric') + /* + * Annotations + */ + // Cutlist store.cutlist.addCut({ cut: 1 }) - // Complete pattern? - if (complete) { - macro('title', { - at: points.title, - nr: 3, - title: 'fabricTip', - rotation: -90, - }) + // Title + macro('title', { + at: points.title, + nr: 3, + title: 'fabricTip', + rotation: -90, + }) - points.logo = points.tip.shiftFractionTowards(points.mid, 0.4) - snippets.logo = new Snippet('logo', points.logo) + // Logo + points.logo = points.tip.shiftFractionTowards(points.mid, 0.4) + snippets.logo = new Snippet('logo', points.logo) - if (sa) seamAllowance(params, 'fabric') - } - - // Paperless? - if (paperless) { - tieShapeDimensions(params) - macro('ld', { - from: points.tip, - to: points.notch1, - d: absoluteOptions.tipWidth / -2.5, - }) - macro('ld', { - from: points.notch2, - to: points.tip, - d: absoluteOptions.tipWidth / -2.5, - }) + // Dimensions + tieShapeDimensions(params) + macro('ld', { + id: 'lTipToNotch1', + from: points.tip, + to: points.notch1, + d: absoluteOptions.tipWidth / -2.5, + }) + macro('ld', { + id: 'lTipToNotch2', + from: points.notch2, + to: points.tip, + d: absoluteOptions.tipWidth / -2.5, + }) + if (complete) paths.n45 = new Path() .move(points.midLeft) .line(points.midRight) - .attr('class', 'hidden') - .attr('data-text', '45°') - .attr('data-text-class', 'center') - } + .addClass('hidden') + .addText('45°', 'center') return params.part } diff --git a/designs/trayvon/src/interfacing.mjs b/designs/trayvon/src/interfacing.mjs index 1ddaefda011..82aa3213edd 100644 --- a/designs/trayvon/src/interfacing.mjs +++ b/designs/trayvon/src/interfacing.mjs @@ -1,67 +1,67 @@ import { draftTieShape, tieShapeDimensions, calculateHelpers, options } from './shared.mjs' function trayvonInterfacingTail(params) { - const { paths, points, macro, complete, paperless, Path, store, absoluteOptions } = params + const { paths, points, macro, complete, Path, store, absoluteOptions } = params calculateHelpers(params) draftTieShape(params, store.get('backTip'), absoluteOptions.knotWidth) - paths.seam.attributes.add('class', 'interfacing') + paths.seam.addClass('interfacing') + /* + * Annotations + */ + // Cutlist store.cutlist.addCut({ cut: 1, material: 'interfacing' }) - // Complete pattern? - if (complete) { - macro('title', { - at: points.title, - nr: 2, - title: 'interfacingTail', - rotation: -90, - }) - } + // Title + macro('title', { + at: points.title, + nr: 2, + title: 'interfacingTail', + rotation: -90, + }) - // Paperless? - if (paperless) { - tieShapeDimensions(params) + // Dimensions + tieShapeDimensions(params) + if (complete) paths.n45 = new Path() .move(points.midLeft) .line(points.midRight) - .attr('class', 'hidden') - .attr('data-text', '45°') - .attr('data-text-class', 'center') - } + .addClass('hidden') + .addText('45°', 'center text-sm fill-note') return params.part } function trayvonInterfacingTip(params) { - const { paths, points, macro, complete, paperless, Path, absoluteOptions, store } = params + const { paths, points, macro, complete, Path, absoluteOptions, store } = params calculateHelpers(params) draftTieShape(params, absoluteOptions.tipWidth, absoluteOptions.knotWidth) - paths.seam.attributes.add('class', 'interfacing') + paths.seam.addClass('interfacing') + /* + * Annotations + */ + // Cutlist store.cutlist.addCut({ cut: 1, material: 'interfacing' }) - // Complete pattern? - if (complete) { - macro('title', { - at: points.title, - nr: 1, - title: 'interfacingTip', - rotation: -90, - }) - } + // Title + macro('title', { + at: points.title, + nr: 1, + title: 'interfacingTip', + rotation: -90, + }) - // Paperless? - if (paperless) { - tieShapeDimensions(params) + // Dimentions + tieShapeDimensions(params) + if (complete) paths.n45 = new Path() .move(points.midLeft) .line(points.midRight) - .attr('class', 'hidden') - .attr('data-text', '45°') - .attr('data-text-class', 'center') - } + .addClass('hidden') + .addText('45°', 'center text-sm fill-note') return params.part } diff --git a/designs/trayvon/src/lining.mjs b/designs/trayvon/src/lining.mjs index 74e47e87cbf..03a685ec016 100644 --- a/designs/trayvon/src/lining.mjs +++ b/designs/trayvon/src/lining.mjs @@ -7,20 +7,8 @@ import { } from './shared.mjs' function trayvonLiningTail(params) { - const { - Path, - Snippet, - complete, - macro, - options, - paths, - points, - paperless, - sa, - snippets, - store, - absoluteOptions, - } = params + const { Path, Snippet, macro, options, paths, points, sa, snippets, store, absoluteOptions } = + params calculateHelpers(params) draftTieShape(params, store.get('backTip') * 2.5, options.knotWidth * 2.5) @@ -38,43 +26,34 @@ function trayvonLiningTail(params) { .line(points.tipRight) .line(points.tip) .close() - .attr('class', 'lining') + .addClass('lining') + if (sa) seamAllowance(params, 'lining') + /* + * Annotations + */ + // Cutlist store.cutlist.addCut({ cut: 1, material: 'lining' }) - // Complete pattern? - if (complete) { - macro('title', { - at: points.title, - nr: 6, - title: 'liningTip', - rotation: -90, - }) - snippets.notch = new Snippet('notch', points.tip) + // Title + macro('title', { + at: points.title, + nr: 6, + title: 'liningTip', + rotation: -90, + }) - if (sa) seamAllowance(params, 'lining') - } + // Notch + snippets.notch = new Snippet('notch', points.tip) - // Paperless? - if (paperless) tieShapeDimensions(params, true) + // Dimensions + tieShapeDimensions(params, true) return params.part } function trayvonLiningTip(params) { - const { - Path, - Snippet, - complete, - macro, - paperless, - paths, - points, - sa, - snippets, - absoluteOptions, - store, - } = params + const { Path, Snippet, macro, paths, points, sa, snippets, absoluteOptions, store } = params calculateHelpers(params) draftTieShape(params, absoluteOptions.tipWidth * 2.5, absoluteOptions.knotWidth * 2.5) @@ -92,28 +71,32 @@ function trayvonLiningTip(params) { .line(points.tipRight) .line(points.tip) .close() - .attr('class', 'lining') + .addClass('lining') + if (sa) seamAllowance(params, 'lining') + + /* + * Annotations + */ + // Cutlist store.cutlist.addCut({ cut: 1, material: 'lining' }) - // Complete pattern? - if (complete) { - macro('title', { - at: points.title, - nr: 5, - title: 'liningTip', - rotation: -90, - }) - snippets.notch = new Snippet('notch', points.tip) - macro('miniscale', { at: points.gridAnchor }) + // Title + macro('title', { + at: points.title, + nr: 5, + title: 'liningTip', + rotation: -90, + }) - if (sa) seamAllowance(params, 'lining') - } + // Notch + snippets.notch = new Snippet('notch', points.tip) - // Paperless? - if (paperless) { - tieShapeDimensions(params, true) - } + // Miniscale + macro('miniscale', { at: points.gridAnchor }) + + // Dimensions + tieShapeDimensions(params, true) return params.part } diff --git a/designs/trayvon/src/loop.mjs b/designs/trayvon/src/loop.mjs index f301a0a08e7..066ab540d73 100644 --- a/designs/trayvon/src/loop.mjs +++ b/designs/trayvon/src/loop.mjs @@ -1,14 +1,32 @@ -function trayvonFabricLoop({ - points, - Point, - paths, - Path, - complete, - paperless, - store, - macro, - part, -}) { +import { interfacingTip } from './interfacing.mjs' + +function trayvonFabricLoop({ points, Point, paths, Path, store, macro, expand, units, part }) { + const w = store.get('backTip') * 3.5 + const h = store.get('backTip') + + 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: `trayvon:cutLoop`, + replace: { + width: units(w), + length: units(h), + }, + suggest: { + text: 'flag:show', + icon: 'expand', + update: { + settings: ['expand', 1], + }, + }, + }) + // Also hint about expand + store.flag.preset('expandIsOff') + + return part.hide() + } + points.topLeft = new Point(0, 0) points.bottomRight = new Point(store.get('backTip') * 3.5, store.get('backTip')) points.topRight = new Point(points.bottomRight.x, points.topLeft.y) @@ -23,36 +41,42 @@ function trayvonFabricLoop({ .close() .attr('class', 'fabric') + /* + * Annotations + */ + // Cutlist store.cutlist.addCut({ cut: 1, material: 'lining' }) - if (complete) { - points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5) + // Title + points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5) + macro('title', { + nr: 7, + title: 'loop', + at: points.title, + align: 'center', + scale: 0.666, + }) - macro('title', { - nr: 7, - title: 'loop', - at: points.title, - }) - } - - if (paperless) { - macro('hd', { - from: points.bottomLeft, - to: points.bottomRight, - y: points.bottomRight.y + 15, - }) - macro('vd', { - from: points.topRight, - to: points.bottomRight, - x: points.topRight.x + 15, - }) - } + // Dimensions + macro('hd', { + id: 'wFull', + from: points.bottomLeft, + to: points.bottomRight, + y: points.bottomRight.y + 15, + }) + macro('vd', { + id: 'hFull', + from: points.topRight, + to: points.bottomRight, + x: points.topRight.x + 15, + }) return part } export const fabricLoop = { name: 'trayvon.fabricLoop', + after: interfacingTip, measurements: ['hpsToWaistBack', 'waistToHips', 'neck'], draft: trayvonFabricLoop, } diff --git a/designs/trayvon/src/shared.mjs b/designs/trayvon/src/shared.mjs index e19c36d7e86..04dfeff453d 100644 --- a/designs/trayvon/src/shared.mjs +++ b/designs/trayvon/src/shared.mjs @@ -12,7 +12,7 @@ export const options = { }, } export const calculateHelpers = ({ store, measurements, options, absoluteOptions }) => { - let halfLength = + const halfLength = (measurements.hpsToWaistBack + measurements.waistToHips + measurements.neck / 2) * (1 + options.lengthBonus) let backTip = absoluteOptions.tipWidth * 0.7 @@ -28,9 +28,9 @@ export const draftTieShape = ( knotWidth, notch = false ) => { - let hl = store.get('halfLength') - let ht = tipWidth / 2 - let hk = knotWidth / 2 + const hl = store.get('halfLength') + const ht = tipWidth / 2 + const hk = knotWidth / 2 points.tip = new Point(0, 0) points.mid = new Point(0, hl) @@ -63,39 +63,45 @@ export const draftTieShape = ( .close() } -export const tieShapeDimensions = ({ points, macro, paths, Path }, lining = false) => { +export const tieShapeDimensions = ({ points, macro, paths, Path, complete }, lining = false) => { macro('hd', { + id: 'wFull', from: points.tipLeft, to: points.tipRight, y: points.tip.y - 15, }) macro('vd', { + id: 'hTip', from: points.tipRight, to: points.tip, x: points.tipRight.x + 15, }) if (lining) { macro('vd', { + id: 'hFull', from: points.cutRight, to: points.tip, x: points.cutRight.x + 30, }) } else { macro('hd', { + id: 'wAtTip', from: points._tmp3, to: points._tmp1, y: points.midLeft.y + 15, }) macro('vd', { + id: 'hLength', from: points.mid, to: points.tip, x: points.tipRight.x + 30, }) - paths.hint = new Path() - .move(points._tmp3) - .line(points._tmp1) - .line(points.midRight) - .attr('class', 'dotted') + if (complete) + paths.hint = new Path() + .move(points._tmp3) + .line(points._tmp1) + .line(points.midRight) + .attr('class', 'dotted') } }