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",
"difficulty": 2,
"tags": ["accessories"],
"techniques": []
"techniques": ["precision", "lining"]
},
"tutorial": {
"description": "A FreeSewing pattern for a baby bib that's used in our tutorial",

View file

@ -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",

View file

@ -7,16 +7,20 @@ 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) {
// Title
macro('title', {
at: points.title,
nr: 4,
@ -24,56 +28,46 @@ function trayvonFabricTail(params) {
rotation: -90,
})
if (sa) seamAllowance(params, 'fabric')
}
// Paperless?
if (paperless) {
// 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) {
// Title
macro('title', {
at: points.title,
nr: 3,
@ -81,32 +75,30 @@ function trayvonFabricTip(params) {
rotation: -90,
})
// 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) {
// 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
}

View file

@ -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) {
// Title
macro('title', {
at: points.title,
nr: 2,
title: 'interfacingTail',
rotation: -90,
})
}
// Paperless?
if (paperless) {
// 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) {
// Title
macro('title', {
at: points.title,
nr: 1,
title: 'interfacingTip',
rotation: -90,
})
}
// Paperless?
if (paperless) {
// 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
}

View file

@ -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) {
// Title
macro('title', {
at: points.title,
nr: 6,
title: 'liningTip',
rotation: -90,
})
// Notch
snippets.notch = new Snippet('notch', points.tip)
if (sa) seamAllowance(params, 'lining')
}
// 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) {
// Title
macro('title', {
at: points.title,
nr: 5,
title: 'liningTip',
rotation: -90,
})
// Notch
snippets.notch = new Snippet('notch', points.tip)
// Miniscale
macro('miniscale', { at: points.gridAnchor })
if (sa) seamAllowance(params, 'lining')
}
// Paperless?
if (paperless) {
// Dimensions
tieShapeDimensions(params, true)
}
return params.part
}

View file

@ -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) {
// Title
points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5)
macro('title', {
nr: 7,
title: 'loop',
at: points.title,
align: 'center',
scale: 0.666,
})
}
if (paperless) {
// 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,
}

View file

@ -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,34 +63,40 @@ 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,
})
if (complete)
paths.hint = new Path()
.move(points._tmp3)
.line(points._tmp1)