1
0
Fork 0

Merge pull request #5010 from freesewing/joost

chore(trayvon): Prepare for v3 beta
This commit is contained in:
Joost De Cock 2023-09-19 20:05:10 +02:00 committed by GitHub
commit 04802aae0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 220 additions and 212 deletions

View file

@ -382,7 +382,7 @@
"design": "Joost De Cock", "design": "Joost De Cock",
"difficulty": 2, "difficulty": 2,
"tags": ["accessories"], "tags": ["accessories"],
"techniques": [] "techniques": ["precision", "lining"]
}, },
"tutorial": { "tutorial": {
"description": "A FreeSewing pattern for a baby bib that's used in our tutorial", "description": "A FreeSewing pattern for a baby bib that's used in our tutorial",

View file

@ -10,7 +10,10 @@
"liningTail": "Lining tail", "liningTail": "Lining tail",
"liningTip": "Lining tip" "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": { "o": {
"tipWidth": { "tipWidth": {
"t": "Tip width", "t": "Tip width",

View file

@ -7,106 +7,98 @@ import {
} from './shared.mjs' } from './shared.mjs'
function trayvonFabricTail(params) { 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) calculateHelpers(params)
draftTieShape(params, store.get('backTip') * 2.5, absoluteOptions.knotWidth * 2.5, true) 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 }) store.cutlist.addCut({ cut: 1 })
// Complete pattern? // Title
if (complete) { macro('title', {
macro('title', { at: points.title,
at: points.title, nr: 4,
nr: 4, title: 'fabricTail',
title: 'fabricTail', rotation: -90,
rotation: -90, })
})
if (sa) seamAllowance(params, 'fabric') // Dimensions
} tieShapeDimensions(params)
macro('ld', {
// Paperless? id: 'lTipToNotch1',
if (paperless) { from: points.tip,
tieShapeDimensions(params) to: points.notch1,
macro('ld', { d: absoluteOptions.tipWidth / -2.5,
from: points.tip, })
to: points.notch1, macro('ld', {
d: absoluteOptions.tipWidth / -2.5, id: 'lTipToNotch2',
}) from: points.notch2,
macro('ld', { to: points.tip,
from: points.notch2, d: absoluteOptions.tipWidth / -2.5,
to: points.tip, })
d: absoluteOptions.tipWidth / -2.5, if (complete)
})
paths.n45 = new Path() paths.n45 = new Path()
.move(points.midLeft) .move(points.midLeft)
.line(points.midRight) .line(points.midRight)
.attr('class', 'hidden') .addClass('hidden')
.attr('data-text', '45°') .addText('45°', 'center')
.attr('data-text-class', 'center')
}
return params.part return params.part
} }
function trayvonFabricTip(params) { function trayvonFabricTip(params) {
const { const { Path, Snippet, complete, macro, paths, points, sa, snippets, absoluteOptions, store } =
Path, params
Snippet,
complete,
macro,
paths,
paperless,
points,
sa,
snippets,
absoluteOptions,
store,
} = params
calculateHelpers(params) calculateHelpers(params)
draftTieShape(params, absoluteOptions.tipWidth * 2.5, absoluteOptions.knotWidth * 2.5, true) 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 }) store.cutlist.addCut({ cut: 1 })
// Complete pattern? // Title
if (complete) { macro('title', {
macro('title', { at: points.title,
at: points.title, nr: 3,
nr: 3, title: 'fabricTip',
title: 'fabricTip', rotation: -90,
rotation: -90, })
})
points.logo = points.tip.shiftFractionTowards(points.mid, 0.4) // Logo
snippets.logo = new Snippet('logo', points.logo) points.logo = points.tip.shiftFractionTowards(points.mid, 0.4)
snippets.logo = new Snippet('logo', points.logo)
if (sa) seamAllowance(params, 'fabric') // Dimensions
} tieShapeDimensions(params)
macro('ld', {
// Paperless? id: 'lTipToNotch1',
if (paperless) { from: points.tip,
tieShapeDimensions(params) to: points.notch1,
macro('ld', { d: absoluteOptions.tipWidth / -2.5,
from: points.tip, })
to: points.notch1, macro('ld', {
d: absoluteOptions.tipWidth / -2.5, id: 'lTipToNotch2',
}) from: points.notch2,
macro('ld', { to: points.tip,
from: points.notch2, d: absoluteOptions.tipWidth / -2.5,
to: points.tip, })
d: absoluteOptions.tipWidth / -2.5, if (complete)
})
paths.n45 = new Path() paths.n45 = new Path()
.move(points.midLeft) .move(points.midLeft)
.line(points.midRight) .line(points.midRight)
.attr('class', 'hidden') .addClass('hidden')
.attr('data-text', '45°') .addText('45°', 'center')
.attr('data-text-class', 'center')
}
return params.part return params.part
} }

View file

@ -1,67 +1,67 @@
import { draftTieShape, tieShapeDimensions, calculateHelpers, options } from './shared.mjs' import { draftTieShape, tieShapeDimensions, calculateHelpers, options } from './shared.mjs'
function trayvonInterfacingTail(params) { function trayvonInterfacingTail(params) {
const { paths, points, macro, complete, paperless, Path, store, absoluteOptions } = params const { paths, points, macro, complete, Path, store, absoluteOptions } = params
calculateHelpers(params) calculateHelpers(params)
draftTieShape(params, store.get('backTip'), absoluteOptions.knotWidth) 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' }) store.cutlist.addCut({ cut: 1, material: 'interfacing' })
// Complete pattern? // Title
if (complete) { macro('title', {
macro('title', { at: points.title,
at: points.title, nr: 2,
nr: 2, title: 'interfacingTail',
title: 'interfacingTail', rotation: -90,
rotation: -90, })
})
}
// Paperless? // Dimensions
if (paperless) { tieShapeDimensions(params)
tieShapeDimensions(params) if (complete)
paths.n45 = new Path() paths.n45 = new Path()
.move(points.midLeft) .move(points.midLeft)
.line(points.midRight) .line(points.midRight)
.attr('class', 'hidden') .addClass('hidden')
.attr('data-text', '45°') .addText('45°', 'center text-sm fill-note')
.attr('data-text-class', 'center')
}
return params.part return params.part
} }
function trayvonInterfacingTip(params) { function trayvonInterfacingTip(params) {
const { paths, points, macro, complete, paperless, Path, absoluteOptions, store } = params const { paths, points, macro, complete, Path, absoluteOptions, store } = params
calculateHelpers(params) calculateHelpers(params)
draftTieShape(params, absoluteOptions.tipWidth, absoluteOptions.knotWidth) 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' }) store.cutlist.addCut({ cut: 1, material: 'interfacing' })
// Complete pattern? // Title
if (complete) { macro('title', {
macro('title', { at: points.title,
at: points.title, nr: 1,
nr: 1, title: 'interfacingTip',
title: 'interfacingTip', rotation: -90,
rotation: -90, })
})
}
// Paperless? // Dimentions
if (paperless) { tieShapeDimensions(params)
tieShapeDimensions(params) if (complete)
paths.n45 = new Path() paths.n45 = new Path()
.move(points.midLeft) .move(points.midLeft)
.line(points.midRight) .line(points.midRight)
.attr('class', 'hidden') .addClass('hidden')
.attr('data-text', '45°') .addText('45°', 'center text-sm fill-note')
.attr('data-text-class', 'center')
}
return params.part return params.part
} }

View file

@ -7,20 +7,8 @@ import {
} from './shared.mjs' } from './shared.mjs'
function trayvonLiningTail(params) { function trayvonLiningTail(params) {
const { const { Path, Snippet, macro, options, paths, points, sa, snippets, store, absoluteOptions } =
Path, params
Snippet,
complete,
macro,
options,
paths,
points,
paperless,
sa,
snippets,
store,
absoluteOptions,
} = params
calculateHelpers(params) calculateHelpers(params)
draftTieShape(params, store.get('backTip') * 2.5, options.knotWidth * 2.5) draftTieShape(params, store.get('backTip') * 2.5, options.knotWidth * 2.5)
@ -38,43 +26,34 @@ function trayvonLiningTail(params) {
.line(points.tipRight) .line(points.tipRight)
.line(points.tip) .line(points.tip)
.close() .close()
.attr('class', 'lining') .addClass('lining')
if (sa) seamAllowance(params, 'lining')
/*
* Annotations
*/
// Cutlist
store.cutlist.addCut({ cut: 1, material: 'lining' }) store.cutlist.addCut({ cut: 1, material: 'lining' })
// Complete pattern? // Title
if (complete) { macro('title', {
macro('title', { at: points.title,
at: points.title, nr: 6,
nr: 6, title: 'liningTip',
title: 'liningTip', rotation: -90,
rotation: -90, })
})
snippets.notch = new Snippet('notch', points.tip)
if (sa) seamAllowance(params, 'lining') // Notch
} snippets.notch = new Snippet('notch', points.tip)
// Paperless? // Dimensions
if (paperless) tieShapeDimensions(params, true) tieShapeDimensions(params, true)
return params.part return params.part
} }
function trayvonLiningTip(params) { function trayvonLiningTip(params) {
const { const { Path, Snippet, macro, paths, points, sa, snippets, absoluteOptions, store } = params
Path,
Snippet,
complete,
macro,
paperless,
paths,
points,
sa,
snippets,
absoluteOptions,
store,
} = params
calculateHelpers(params) calculateHelpers(params)
draftTieShape(params, absoluteOptions.tipWidth * 2.5, absoluteOptions.knotWidth * 2.5) draftTieShape(params, absoluteOptions.tipWidth * 2.5, absoluteOptions.knotWidth * 2.5)
@ -92,28 +71,32 @@ function trayvonLiningTip(params) {
.line(points.tipRight) .line(points.tipRight)
.line(points.tip) .line(points.tip)
.close() .close()
.attr('class', 'lining') .addClass('lining')
if (sa) seamAllowance(params, 'lining')
/*
* Annotations
*/
// Cutlist
store.cutlist.addCut({ cut: 1, material: 'lining' }) store.cutlist.addCut({ cut: 1, material: 'lining' })
// Complete pattern? // Title
if (complete) { macro('title', {
macro('title', { at: points.title,
at: points.title, nr: 5,
nr: 5, title: 'liningTip',
title: 'liningTip', rotation: -90,
rotation: -90, })
})
snippets.notch = new Snippet('notch', points.tip)
macro('miniscale', { at: points.gridAnchor })
if (sa) seamAllowance(params, 'lining') // Notch
} snippets.notch = new Snippet('notch', points.tip)
// Paperless? // Miniscale
if (paperless) { macro('miniscale', { at: points.gridAnchor })
tieShapeDimensions(params, true)
} // Dimensions
tieShapeDimensions(params, true)
return params.part return params.part
} }

View file

@ -1,14 +1,32 @@
function trayvonFabricLoop({ import { interfacingTip } from './interfacing.mjs'
points,
Point, function trayvonFabricLoop({ points, Point, paths, Path, store, macro, expand, units, part }) {
paths, const w = store.get('backTip') * 3.5
Path, const h = store.get('backTip')
complete,
paperless, if (expand) store.flag.preset('expandIsOn')
store, else {
macro, // Expand is on, do not draw the part but flag this to the user
part, 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.topLeft = new Point(0, 0)
points.bottomRight = new Point(store.get('backTip') * 3.5, store.get('backTip')) points.bottomRight = new Point(store.get('backTip') * 3.5, store.get('backTip'))
points.topRight = new Point(points.bottomRight.x, points.topLeft.y) points.topRight = new Point(points.bottomRight.x, points.topLeft.y)
@ -23,36 +41,42 @@ function trayvonFabricLoop({
.close() .close()
.attr('class', 'fabric') .attr('class', 'fabric')
/*
* Annotations
*/
// Cutlist
store.cutlist.addCut({ cut: 1, material: 'lining' }) store.cutlist.addCut({ cut: 1, material: 'lining' })
if (complete) { // Title
points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5) 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', { // Dimensions
nr: 7, macro('hd', {
title: 'loop', id: 'wFull',
at: points.title, from: points.bottomLeft,
}) to: points.bottomRight,
} y: points.bottomRight.y + 15,
})
if (paperless) { macro('vd', {
macro('hd', { id: 'hFull',
from: points.bottomLeft, from: points.topRight,
to: points.bottomRight, to: points.bottomRight,
y: points.bottomRight.y + 15, x: points.topRight.x + 15,
}) })
macro('vd', {
from: points.topRight,
to: points.bottomRight,
x: points.topRight.x + 15,
})
}
return part return part
} }
export const fabricLoop = { export const fabricLoop = {
name: 'trayvon.fabricLoop', name: 'trayvon.fabricLoop',
after: interfacingTip,
measurements: ['hpsToWaistBack', 'waistToHips', 'neck'], measurements: ['hpsToWaistBack', 'waistToHips', 'neck'],
draft: trayvonFabricLoop, draft: trayvonFabricLoop,
} }

View file

@ -12,7 +12,7 @@ export const options = {
}, },
} }
export const calculateHelpers = ({ store, measurements, options, absoluteOptions }) => { export const calculateHelpers = ({ store, measurements, options, absoluteOptions }) => {
let halfLength = const halfLength =
(measurements.hpsToWaistBack + measurements.waistToHips + measurements.neck / 2) * (measurements.hpsToWaistBack + measurements.waistToHips + measurements.neck / 2) *
(1 + options.lengthBonus) (1 + options.lengthBonus)
let backTip = absoluteOptions.tipWidth * 0.7 let backTip = absoluteOptions.tipWidth * 0.7
@ -28,9 +28,9 @@ export const draftTieShape = (
knotWidth, knotWidth,
notch = false notch = false
) => { ) => {
let hl = store.get('halfLength') const hl = store.get('halfLength')
let ht = tipWidth / 2 const ht = tipWidth / 2
let hk = knotWidth / 2 const hk = knotWidth / 2
points.tip = new Point(0, 0) points.tip = new Point(0, 0)
points.mid = new Point(0, hl) points.mid = new Point(0, hl)
@ -63,39 +63,45 @@ export const draftTieShape = (
.close() .close()
} }
export const tieShapeDimensions = ({ points, macro, paths, Path }, lining = false) => { export const tieShapeDimensions = ({ points, macro, paths, Path, complete }, lining = false) => {
macro('hd', { macro('hd', {
id: 'wFull',
from: points.tipLeft, from: points.tipLeft,
to: points.tipRight, to: points.tipRight,
y: points.tip.y - 15, y: points.tip.y - 15,
}) })
macro('vd', { macro('vd', {
id: 'hTip',
from: points.tipRight, from: points.tipRight,
to: points.tip, to: points.tip,
x: points.tipRight.x + 15, x: points.tipRight.x + 15,
}) })
if (lining) { if (lining) {
macro('vd', { macro('vd', {
id: 'hFull',
from: points.cutRight, from: points.cutRight,
to: points.tip, to: points.tip,
x: points.cutRight.x + 30, x: points.cutRight.x + 30,
}) })
} else { } else {
macro('hd', { macro('hd', {
id: 'wAtTip',
from: points._tmp3, from: points._tmp3,
to: points._tmp1, to: points._tmp1,
y: points.midLeft.y + 15, y: points.midLeft.y + 15,
}) })
macro('vd', { macro('vd', {
id: 'hLength',
from: points.mid, from: points.mid,
to: points.tip, to: points.tip,
x: points.tipRight.x + 30, x: points.tipRight.x + 30,
}) })
paths.hint = new Path() if (complete)
.move(points._tmp3) paths.hint = new Path()
.line(points._tmp1) .move(points._tmp3)
.line(points.midRight) .line(points._tmp1)
.attr('class', 'dotted') .line(points.midRight)
.attr('class', 'dotted')
} }
} }