From 63039e08829096a82d6f361ce57fe260df7a5509 Mon Sep 17 00:00:00 2001 From: woutervdub Date: Sun, 15 Oct 2023 17:29:26 +0000 Subject: [PATCH] almost done --- designs/waralee/i18n/en.json | 33 ++++- designs/waralee/src/backpocket.mjs | 60 ++++++--- designs/waralee/src/facings.mjs | 195 ++++++++++++++--------------- designs/waralee/src/ghost.mjs | 107 ++++++++++++++++ designs/waralee/src/index.mjs | 8 +- designs/waralee/src/options.mjs | 18 ++- designs/waralee/src/pants.mjs | 2 + designs/waralee/src/pantsproto.mjs | 79 ++++++++++-- designs/waralee/src/pocket.mjs | 126 ++++++------------- designs/waralee/src/waistband.mjs | 26 ++-- 10 files changed, 414 insertions(+), 240 deletions(-) create mode 100644 designs/waralee/src/ghost.mjs diff --git a/designs/waralee/i18n/en.json b/designs/waralee/i18n/en.json index cb9a085c419..6009c69985d 100644 --- a/designs/waralee/i18n/en.json +++ b/designs/waralee/i18n/en.json @@ -4,10 +4,11 @@ "p": { "backPocket": "Back pocket", "cutout": "Cutout", - "facings": "Facings", - "mini": "Mini", + "facingBack": "Back Pocket Facing", + "facingFront": "Front Pocket Facing", + "mini": "Mini version", "pants": "Pants", - "pantsProto": "FIXME: Give this part a name", + "pantsProto": "Pants prototype", "pocket": "Pocket", "strapBack": "Strap back", "strapFront": "Strap front", @@ -15,6 +16,12 @@ "waistbandFront": "Waistband front" }, "s": { + "cutBackPocket.t": "The back pocket is not shown", + "cutBackPocket.d": "The **back pocket** is made of two rectangles of fabric {{{ width }}} wide and {{{ length }}} long.", + "cutFacingback.t": "The back pocket facing is not shown", + "cutFacingback.d": "The **back pocket facing** is made of a rectangle of fabric {{{ width }}} wide and {{{ length }}} long.", + "cutFacingfront.t": "The front pocket facing is not shown", + "cutFacingfront.d": "The **front pocket facing** is made of a rectangle of fabric {{{ width }}} wide and {{{ length }}} long.", "cutwaistbandBack.t": "The back waist band is not shown", "cutwaistbandBack.d": "The **back waist band** is made of two strips of fabric {{{ width }}} wide and {{{ length }}} long.", "cutwaistbandFront.t": "The front waist band is not shown", @@ -33,10 +40,26 @@ "t": "Back pocket", "d": "Whether to include a back pocket or not" }, + "backPocketYes": { + "t": "Back pocket", + "d": "The back pocket is included" + }, + "backPocketNo": { + "t": "No Back pocket", + "d": "The pattern is drawn without a back pocket" + }, "frontPocket": { "t": "Front pocket", "d": "Whether to include a front pocket or not" }, + "frontPocketYes": { + "t": "Front pocket", + "d": "The front pocket is included" + }, + "frontPocketNo": { + "t": "No Front pocket", + "d": "The pattern is drawn without a front pocket" + }, "hemWidth": { "t": "Hem size", "d": "Size of the hem at the bottom of the pants" @@ -110,8 +133,8 @@ "d": "The front pocket will be hidden in the seam of the waistband." }, "knotInFront": { - "t": "Placement of the knot", - "d": "The knot of the wrap straps can be place in the front or back." + "t": "Place the knot in the front", + "d": "The knot of the wrap straps can be placed in the front or back." }, "knotInFrontNo": { "t": "Knot in the back", diff --git a/designs/waralee/src/backpocket.mjs b/designs/waralee/src/backpocket.mjs index 295b7d40448..d4f81d7ced4 100644 --- a/designs/waralee/src/backpocket.mjs +++ b/designs/waralee/src/backpocket.mjs @@ -14,40 +14,70 @@ export const backPocket = { snippets, macro, sa, + store, + expand, + units, part, }) => { if (false == options.backPocket) { - return part + return part.hide() } + const pocketDepth = options.backPocketDepth * measurements.crotchDepth - const pocketDepth = options.backPocketDepth + if (!expand) { + // Expand is on, do not draw the part but flag this to the user + store.flag.note({ + msg: `waralee:cutBackPocket`, + replace: { + width: units(options.backPocketSize * measurements.crotchDepth), + length: units(pocketDepth + options.backPocketVerticalOffset * measurements.crotchDepth), + }, + suggest: { + text: 'flag:show', + icon: 'expand', + update: { + settings: ['expand', 1], + }, + }, + }) + // Also hint about expand + store.flag.preset('expand') + + return part.hide() + } points.topLeft = new Point(0, 0) points.bottomLeft = points.topLeft.shift( 270, - pocketDepth /*+ 30*/ * 2 + - options.backPocketVerticalOffset * measurements.crotchDepth /*- measurements.waistToHips*/ + pocketDepth + options.backPocketVerticalOffset * measurements.crotchDepth ) - points.topRight = points.topLeft.shift( - 0, - options.backPocketSize * measurements.crotchDepth /*- measurements.waistToHips*/ /*+ 24*/ - ) + points.topRight = points.topLeft.shift(0, options.backPocketSize * measurements.crotchDepth) points.bottomRight = points.topRight.shift( 270, - pocketDepth /*+ 30*/ * 2 + - options.backPocketVerticalOffset * measurements.crotchDepth /*- measurements.waistToHips*/ + pocketDepth + options.backPocketVerticalOffset * measurements.crotchDepth ) - paths.seam = new Path() - .move(points.topLeft) - .line(points.bottomLeft) - .line(points.bottomRight) + paths.seamSA = new Path() + .move(points.bottomRight) .line(points.topRight) .line(points.topLeft) + .line(points.bottomLeft) + .hide() + paths.seam = new Path() + .move(points.bottomLeft) + .line(points.bottomRight) + .join(paths.seamSA) .close() .attr('class', 'fabric') + macro('cutonfold', { + from: points.bottomLeft, + to: points.bottomRight, + }) + + store.cutlist.addCut({ cut: 2, from: 'lining' }) + points.title = points.topLeft.shift(270, 75).shift(0, 50) macro('title', { nr: 4, @@ -62,7 +92,7 @@ export const backPocket = { .attr('data-text', 'Waralee') .attr('data-text-class', 'center') - if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa') + if (sa) paths.sa = paths.seamSA.close().offset(sa).attr('class', 'fabric sa') macro('hd', { id: 1, diff --git a/designs/waralee/src/facings.mjs b/designs/waralee/src/facings.mjs index 40240b61876..935429038a0 100644 --- a/designs/waralee/src/facings.mjs +++ b/designs/waralee/src/facings.mjs @@ -1,9 +1,8 @@ import { pantsProto } from './pantsproto.mjs' -export const facings = { - name: 'waralee.facings', - after: pantsProto, - draft: ({ +function waraleeFacing( + type, + { options, measurements, Point, @@ -14,106 +13,102 @@ export const facings = { snippets, macro, sa, + store, + expand, + units, part, - }) => { - const frontPocketSize = - options.frontPocketSize * measurements.crotchDepth /*- measurements.waistToHips*/ - const backPocketSize = - options.backPocketSize * measurements.crotchDepth /*- measurements.waistToHips*/ + } +) { + const frontPocketSize = + options.frontPocketSize * measurements.crotchDepth /*- measurements.waistToHips*/ + const backPocketSize = + options.backPocketSize * measurements.crotchDepth /*- measurements.waistToHips*/ - points.frontTL = new Point(0, 0) - points.frontTR = points.frontTL.shift(0, frontPocketSize + sa + sa) - points.frontBL = points.frontTL.shift(270, frontPocketSize / 2) - points.frontBR = points.frontTR.shift(270, frontPocketSize / 2) - - points.backTL = points.frontBL.shift(270, 50) - points.backTR = points.backTL.shift(0, backPocketSize + sa + sa) - points.backBL = points.backTL.shift(270, backPocketSize / 2) - points.backBR = points.backTR.shift(270, backPocketSize / 2) - - paths.frontSeam = new Path() - .move(points.frontTL) - .line(points.frontBL) - .line(points.frontBR) - .line(points.frontTR) - .line(points.frontTL) - .close() - .attr('class', 'fabric') - .setHidden(!(options.frontPocket && 'welt' == options.frontPocketStyle)) - - paths.backSeam = new Path() - .move(points.backTL) - .line(points.backBL) - .line(points.backBR) - .line(points.backTR) - .line(points.backTL) - .close() - .attr('class', 'fabric') - .setHidden(!options.backPocket) - - if (options.frontPocket && 'welt' == options.frontPocketStyle) { - points.frontTitle = points.frontTL.shift(270, 30).shift(0, 40) - macro('title', { - nr: 5, - at: points.frontTitle.shift(0, 30), - title: 'frontFacing', - prefix: 'front', - scale: 0.6, - }) - - points.frontLogo = points.frontTitle.shift(270, 0) - snippets.frontLogo = new Snippet('logo', points.frontLogo).attr('data-scale', 0.3) - points.frontText = points.frontLogo - .shift(-90, 15) - .attr('data-text', 'Waralee') - .attr('data-text-class', 'center') + if (type == 'front') { + if (!options.frontPocket || 'welt' != options.frontPocketStyle) { + return part.hide() } - if (options.backPocket) { - points.backTitle = points.backTL.shift(270, 30).shift(0, 40) - macro('title', { - nr: 6, - at: points.backTitle.shift(0, 30), - title: 'backFacing', - prefix: 'back', - scale: 0.6, - }) - points.backLogo = points.backTitle.shift(270, 0) - snippets.backLogo = new Snippet('logo', points.backLogo).attr('data-scale', 0.3) - points.backText = points.backLogo - .shift(-90, 15) - .attr('data-text', 'Waralee') - .attr('data-text-class', 'center') + } else { + if (!options.backPocket) { + return part.hide() } + } - if (options.frontPocket && 'welt' == options.frontPocketStyle) { - macro('hd', { - id: 1, - from: points.frontTL, - to: points.frontTR, - y: points.frontTL.y + 15, - }) - macro('vd', { - id: 2, - from: points.frontTL, - to: points.frontBL, - x: points.frontTL.x + 15, - }) - } - if (options.backPocket) { - macro('hd', { - id: 3, - from: points.backTL, - to: points.backTR, - y: points.backTL.y + 15, - }) - macro('vd', { - id: 4, - from: points.backTL, - to: points.backBL, - x: points.backTL.x + 15, - }) - } + const width = (type == 'front' ? frontPocketSize : backPocketSize) + sa + sa + const height = (type == 'front' ? frontPocketSize : backPocketSize) / 2 - return part - }, + if (!expand) { + // Expand is on, do not draw the part but flag this to the user + store.flag.note({ + msg: `waralee:cutFacing` + type, + replace: { + width: units(width), + length: units(height), + }, + suggest: { + text: 'flag:show', + icon: 'expand', + update: { + settings: ['expand', 1], + }, + }, + }) + // Also hint about expand + store.flag.preset('expand') + + return part.hide() + } + + points.tl = new Point(0, 0) + points.tr = points.tl.shift(0, width) + points.bl = points.tl.shift(270, height) + points.br = points.tr.shift(270, height) + + paths.seamSeam = new Path() + .move(points.tl) + .line(points.bl) + .line(points.br) + .line(points.tr) + .line(points.tl) + .close() + .attr('class', 'fabric') + + store.cutlist.addCut({ cut: type == 'front' ? 4 : 2, from: 'fabric' }) + + points.title = points.tl.shift(270, 30).shift(0, 40) + macro('title', { + nr: type == 'front' ? 5 : 6, + at: points.title.shift(0, 30), + title: type + 'Facing', + scale: 0.6, + }) + + points.logo = points.title.shift(270, 0) + snippets.logo = new Snippet('logo', points.logo).attr('data-scale', 0.3) + + macro('hd', { + id: 1, + from: points.tl, + to: points.tr, + y: points.tl.y + 15, + }) + macro('vd', { + id: 2, + from: points.tl, + to: points.bl, + x: points.tl.x + 15, + }) + + return part +} + +export const facingFront = { + name: 'waralee.facingFront', + after: pantsProto, + draft: (part) => waraleeFacing('front', part), +} +export const facingBack = { + name: 'waralee.facingBack', + after: pantsProto, + draft: (part) => waraleeFacing('back', part), } diff --git a/designs/waralee/src/ghost.mjs b/designs/waralee/src/ghost.mjs new file mode 100644 index 00000000000..17f50036788 --- /dev/null +++ b/designs/waralee/src/ghost.mjs @@ -0,0 +1,107 @@ +import { pantsProto } from './pantsproto.mjs' + +export const ghost = { + name: 'waralee.ghost', + after: pantsProto, + draft: ({ + options, + measurements, + Point, + Path, + points, + paths, + Snippet, + snippets, + sa, + macro, + part, + }) => { + const c = 0.55191502449351 + const eyeSize = 0.02 + const size = 500 + + points.middle = new Point(0, 0) + points.eyeLine = points.middle.shift(270, size / 10) + points.eyeLeft = points.eyeLine.shift(180, size / 20) + points.eyeRight = points.eyeLine.shift(0, size / 20) + points.top = new Point(0, -1 * size) + points.left = new Point(-1 * size, 0) + points.right = new Point(size, 0) + points.bottom = new Point(0, size) + points.topCp1 = points.top.shift(180, size * c) + points.topCp2 = points.top.shift(0, size * c) + points.leftCp1 = points.left.shift(270, size * c) + points.leftCp2 = points.left.shift(90, size * c) + points.bottomCp1 = points.bottom.shift(0, size * c) + points.bottomCp2 = points.bottom.shift(180, size * c) + points.rightCp1 = points.right.shift(90, size * c) + points.rightCp2 = points.right.shift(270, size * c) + + points.eyeLefttop = points.eyeLeft.shift(90, size * eyeSize) + points.eyeLeftleft = points.eyeLeft.shift(180, size * eyeSize) + points.eyeLeftbottom = points.eyeLeft.shift(270, size * eyeSize) + points.eyeLeftright = points.eyeLeft.shift(0, size * eyeSize) + points.eyeLefttopCp1 = points.eyeLefttop.shift(180, size * c * eyeSize) + points.eyeLefttopCp2 = points.eyeLefttop.shift(0, size * c * eyeSize) + points.eyeLeftleftCp1 = points.eyeLeftleft.shift(270, size * c * eyeSize) + points.eyeLeftleftCp2 = points.eyeLeftleft.shift(90, size * c * eyeSize) + points.eyeLeftbottomCp1 = points.eyeLeftbottom.shift(0, size * c * eyeSize) + points.eyeLeftbottomCp2 = points.eyeLeftbottom.shift(180, size * c * eyeSize) + points.eyeLeftrightCp1 = points.eyeLeftright.shift(90, size * c * eyeSize) + points.eyeLeftrightCp2 = points.eyeLeftright.shift(270, size * c * eyeSize) + + points.eyeRighttop = points.eyeRight.shift(90, size * eyeSize) + points.eyeRightleft = points.eyeRight.shift(180, size * eyeSize) + points.eyeRightbottom = points.eyeRight.shift(270, size * eyeSize) + points.eyeRightright = points.eyeRight.shift(0, size * eyeSize) + points.eyeRighttopCp1 = points.eyeRighttop.shift(180, size * c * eyeSize) + points.eyeRighttopCp2 = points.eyeRighttop.shift(0, size * c * eyeSize) + points.eyeRightleftCp1 = points.eyeRightleft.shift(270, size * c * eyeSize) + points.eyeRightleftCp2 = points.eyeRightleft.shift(90, size * c * eyeSize) + points.eyeRightbottomCp1 = points.eyeRightbottom.shift(0, size * c * eyeSize) + points.eyeRightbottomCp2 = points.eyeRightbottom.shift(180, size * c * eyeSize) + points.eyeRightrightCp1 = points.eyeRightright.shift(90, size * c * eyeSize) + points.eyeRightrightCp2 = points.eyeRightright.shift(270, size * c * eyeSize) + + console.log({ points: JSON.parse(JSON.stringify(points)) }) + + paths.seam = new Path() + .move(points.top) + .curve(points.topCp1, points.leftCp2, points.left) + .curve(points.leftCp1, points.bottomCp2, points.bottom) + .curve(points.bottomCp1, points.rightCp2, points.right) + .curve(points.rightCp1, points.topCp2, points.top) + .close() + .attr('class', 'fabric') + + paths.eyeLeft = new Path() + .move(points.eyeLefttop) + .curve(points.eyeLefttopCp1, points.eyeLeftleftCp2, points.eyeLeftleft) + .curve(points.eyeLeftleftCp1, points.eyeLeftbottomCp2, points.eyeLeftbottom) + .curve(points.eyeLeftbottomCp1, points.eyeLeftrightCp2, points.eyeLeftright) + .curve(points.eyeLeftrightCp1, points.eyeLefttopCp2, points.eyeLefttop) + .close() + .attr('class', 'fabric') + + paths.eyeRight = new Path() + .move(points.eyeRighttop) + .curve(points.eyeRighttopCp1, points.eyeRightleftCp2, points.eyeRightleft) + .curve(points.eyeRightleftCp1, points.eyeRightbottomCp2, points.eyeRightbottom) + .curve(points.eyeRightbottomCp1, points.eyeRightrightCp2, points.eyeRightright) + .curve(points.eyeRightrightCp1, points.eyeRighttopCp2, points.eyeRighttop) + .close() + .attr('class', 'fabric') + + points.title = points.middle.shiftFractionTowards(points.bottom, 0.65) + macro('title', { + nr: 1, + at: points.title, + title: 'Gozer', + align: 'center', + }) + points.logo = points.middle.shiftFractionTowards(points.bottom, 0.5) + snippets.logo = new Snippet('logo', points.logo) + + return part + }, +} diff --git a/designs/waralee/src/index.mjs b/designs/waralee/src/index.mjs index 34b4867de59..f0254229a8c 100644 --- a/designs/waralee/src/index.mjs +++ b/designs/waralee/src/index.mjs @@ -5,7 +5,7 @@ import { pants } from './pants.mjs' import { cutout } from './cutout.mjs' import { pocket } from './pocket.mjs' import { backPocket } from './backpocket.mjs' -import { facings } from './facings.mjs' +import { facingFront, facingBack } from './facings.mjs' import { mini } from './mini.mjs' import { waistbandFront, waistbandBack, strapFront, strapBack } from './waistband.mjs' // Re-export skeleton parts so peope can re-use them @@ -19,7 +19,8 @@ const Waralee = new Design({ cutout, pocket, backPocket, - facings, + facingFront, + facingBack, mini, waistbandFront, waistbandBack, @@ -34,7 +35,8 @@ export { cutout, pocket, backPocket, - facings, + facingFront, + facingBack, mini, waistbandFront, waistbandBack, diff --git a/designs/waralee/src/options.mjs b/designs/waralee/src/options.mjs index 8d40c7174dc..f3e52efcff8 100644 --- a/designs/waralee/src/options.mjs +++ b/designs/waralee/src/options.mjs @@ -1,6 +1,7 @@ // Fit export const backRaise = { pct: 10, min: 0, max: 25, menu: 'fit' } export const waistRaise = { pct: 0, min: -20, max: 40, menu: 'fit' } +export const fitWaist = { bool: true, menu: 'fit' } // Style export const hemWidth = { pct: 1.75, min: 1, max: 2.5, menu: 'style' } export const legShortening = { pct: 25, min: -10, max: 50, menu: 'style' } @@ -8,6 +9,9 @@ export const waistOverlap = { pct: 50, min: 10, max: 100, menu: 'style' } export const frontPocket = { bool: true, menu: 'style' } export const backPocket = { bool: true, menu: 'style' } export const waistbandWidth = { pct: 3.5, min: 2, max: 5, menu: 'style' } +export const frontPocketStyle = { dflt: 'welt', list: ['welt', 'waistband'], menu: 'style' } +export const separateWaistband = { bool: false, menu: 'style' } +export const knotInFront = { bool: true, menu: 'style' } // Advanced export const crotchFront = { pct: 30, min: 10, max: 70, menu: 'advanced' } export const crotchBack = { pct: 45, min: 10, max: 70, menu: 'advanced' } @@ -16,21 +20,15 @@ export const crotchFactorFrontVer = { pct: 30, min: 10, max: 70, menu: 'advanced export const crotchFactorBackHor = { pct: 90, min: 10, max: 100, menu: 'advanced' } export const crotchFactorBackVer = { pct: 60, min: 20, max: 90, menu: 'advanced' } // Static values -export const minimizer = 4 +export const backWaistAdjustment = 0.3 export const frontPocketVerticalOffset = 0.07 export const frontPocketHorizontalOffset = 0.18 export const frontPocketSize = 0.45 +export const frontPocketWidthHeightRatio = 0.076 export const frontPocketDepthFactor = 1.6 -export const backPocketDepth = 140 +export const frontWaistAdjustment = 0.163 +export const backPocketDepth = 0.5 export const backPocketVerticalOffset = 0.2 export const backPocketHorizontalOffset = 0.045 export const backPocketSize = 0.45 -// Added later -export const frontWaistAdjustment = 0.163 -export const backWaistAdjustment = 0.3 export const crotchEase = 1.08 -export const frontPocketStyle = { dflt: 'welt', list: ['welt', 'waistband'], menu: 'style' } -// export const showMini = { bool: true, menu: 'options' } -export const fitWaist = { bool: true, menu: 'fit' } -export const separateWaistband = { bool: false, menu: 'style' } -export const knotInFront = { bool: true, menu: 'style' } diff --git a/designs/waralee/src/pants.mjs b/designs/waralee/src/pants.mjs index 9a208a4da87..f6d2765fe87 100644 --- a/designs/waralee/src/pants.mjs +++ b/designs/waralee/src/pants.mjs @@ -47,6 +47,8 @@ export const pants = { paths.seam.unhide() + store.cutlist.addCut({ cut: 2, from: 'fabric' }) + points.title = points.fWaistFront.shift(270, 400) macro('title', { nr: 1, diff --git a/designs/waralee/src/pantsproto.mjs b/designs/waralee/src/pantsproto.mjs index c7274e537d4..3880d69ee37 100644 --- a/designs/waralee/src/pantsproto.mjs +++ b/designs/waralee/src/pantsproto.mjs @@ -1,3 +1,4 @@ +import path from 'path' import * as options from './options.mjs' export const pantsProto = { @@ -6,10 +7,7 @@ export const pantsProto = { measurements: ['seat', 'inseam', 'crotchDepth', 'waistToHips'], optionalMeasurements: ['waist', 'waistBack'], options, - draft: ({ options, measurements, Point, Path, points, paths, store, part }) => { - console.log({ measurements: JSON.parse(JSON.stringify(measurements)) }) - console.log({ options: JSON.parse(JSON.stringify(options)) }) - + draft: ({ options, measurements, Point, Path, points, paths, store, part, utils }) => { const seatDepth = measurements.crotchDepth /* - measurements.waistToHips */ * (1 + options.waistRaise) * @@ -30,8 +28,15 @@ export const pantsProto = { const hem = measurements.inseam * options.hemWidth const waistBand = measurements.inseam * options.waistbandWidth + const pocketDepth = + (measurements.crotchDepth - measurements.waistToHips) * options.frontPocketDepthFactor + const frontPocketSize = + options.frontPocketSize * measurements.crotchDepth /*- measurements.waistToHips*/ + store.set('waistBand', waistBand) store.set('hem', hem) + store.set('pocketDepth', pocketDepth) + store.set('frontPocketSize', frontPocketSize) points.mWaist = new Point(0, 0) @@ -63,8 +68,6 @@ export const pantsProto = { points.bHipSide = points.mHip.shift(0, options.crotchBack * circumference4) - console.log({ points: JSON.parse(JSON.stringify(points)) }) - points.fCutOutHip = new Path() .move(points.fWaistSide) .curve(points.fWaistCrotchCP, points.fHipCrotchCP, points.mHip) @@ -216,7 +219,6 @@ export const pantsProto = { paths.waistBack = new Path() .move(separateWaistband ? points.bWaistBackOverlapSeam : points.bWaistBackOverlap) .line(separateWaistband ? points.bWaistBackSeam : points.bWaistBack) - // .line(points.bWaistSideTemp) // This is a trick to make the offset() call work. Without it, the offset is crossing the cutout line. .line(separateWaistband ? points.bWaistSideSeam : points.bWaistSide) .hide() paths.waistFront = new Path() @@ -255,12 +257,14 @@ export const pantsProto = { ) .shift(180, options.frontPocketHorizontalOffset * measurements.seat) - points.frontPocketTop2 = points.frontPocketTop.shift(340, 12) + const frontPocketHeight = frontPocketSize * options.frontPocketWidthHeightRatio + + points.frontPocketTop2 = points.frontPocketTop.shift(340, frontPocketHeight) points.frontPocketBottom = points.frontPocketTop.shift( 250, options.frontPocketSize * measurements.crotchDepth /*- measurements.waistToHips*/ ) - points.frontPocketBottom2 = points.frontPocketBottom.shift(340, 12) + points.frontPocketBottom2 = points.frontPocketBottom.shift(340, frontPocketHeight) paths.frontPocket = new Path() .move(points.frontPocketTop) @@ -270,6 +274,56 @@ export const pantsProto = { .close() .attr('class', 'fabric') .hide() + + points.frontPocketSeam = utils.beamsIntersect( + points.frontPocketBottom, + points.frontPocketTop, + points.fWaistSideSeam, + points.fWaistFrontOverlapSeam + ) + + const frontPocketExtraDepth = points.frontPocketTop.dist(points.frontPocketSeam) + + points.frontPocketTopLeft = points.frontPocketSeam.shiftTowards( + points.fWaistFrontOverlapSeam, + frontPocketHeight + ) + points.frontPocketTopRight = points.frontPocketTopLeft.shift(0, pocketDepth * (1 / 3)) + + points.frontPocketBottomRight = points.frontPocketTopRight.shift( + 270, + pocketDepth + frontPocketExtraDepth + ) + points.frontPocketBottomLeft = points.frontPocketTopLeft.shift( + 250, + pocketDepth * (5 / 6) + frontPocketExtraDepth + ) + + points.frontPocketBottomRightCP = points.frontPocketBottomRight.shift( + 180, + pocketDepth * (1 / 6) + ) + points.frontPocketBottomLeftCP = points.frontPocketBottomLeft.shift( + 315, + pocketDepth * (1 / 4) + ) + + paths.frontPocketSeamSA = new Path() + .move(points.frontPocketTopRight) + .line(points.frontPocketTopLeft) + .line(points.frontPocketBottomLeft) + .curve( + points.frontPocketBottomLeftCP, + points.frontPocketBottomRightCP, + points.frontPocketBottomRight + ) + .hide() + paths.frontPocketSeam = new Path() + .move(points.frontPocketBottomRight) + .line(points.frontPocketTopRight) + .join(paths.frontPocketSeamSA) + .close() + .attr('class', 'dotted mark') } if (options.backPocket) { @@ -312,6 +366,13 @@ export const pantsProto = { .hide() } + path.temp = new Path() + .move(points.bWaistSide) + .line(points.fWaistSide) + .line(points.fLegFront) + .line(points.bLegBack) + .close() + return part.hide() }, } diff --git a/designs/waralee/src/pocket.mjs b/designs/waralee/src/pocket.mjs index 0fc7c7c3d11..e9844985816 100644 --- a/designs/waralee/src/pocket.mjs +++ b/designs/waralee/src/pocket.mjs @@ -2,58 +2,23 @@ import { pantsProto } from './pantsproto.mjs' export const pocket = { name: 'waralee.pocket', - after: pantsProto, - draft: ({ - options, - measurements, - Point, - Path, - points, - paths, - Snippet, - snippets, - sa, - macro, - part, - }) => { + from: pantsProto, + draft: ({ options, Point, Path, points, paths, Snippet, snippets, sa, macro, store, part }) => { if (false == options.frontPocket) { - return part + return part.hide() } const c = 0.55191502449351 - const pocketDepth = - (measurements.crotchDepth - measurements.waistToHips) * options.frontPocketDepthFactor - const frontPocketSize = - options.frontPocketSize * measurements.crotchDepth /*- measurements.waistToHips*/ + const frontPocketSize = store.get('frontPocketSize') - console.log({ pocketDepth: pocketDepth, frontPocketSize: frontPocketSize }) + console.log({ paths: JSON.parse(JSON.stringify(paths)) }) if ('welt' != options.frontPocketStyle) { - points.topLeft = new Point(0, 0) - points.bottomLeft = points.topLeft.shift(270, pocketDepth) - console.log({ nwpoints: JSON.parse(JSON.stringify(points)) }) - - points.topRight = points.topLeft.shift(0, pocketDepth * (1 / 3)) - points.bottomRight = points.topRight.shift(290, pocketDepth * (5 / 6)) - - points.bottomLeftCP = points.bottomLeft.shift(0, pocketDepth * (1 / 6)) - points.bottomRightCP = points.bottomRight.shift(225, pocketDepth * (1 / 4)) - - paths.seam = new Path() - .move(points.topLeft) - .line(points.bottomLeft) - .curve(points.bottomLeftCP, points.bottomRightCP, points.bottomRight) - .line(points.topRight) - .line(points.topLeft) - .close() - .attr('class', 'fabric') - } else { points.topLeft = new Point(0, 0) points.topRight = points.topLeft.shift(0, frontPocketSize) points.bottomLeft = points.topLeft.shift(270, frontPocketSize * 1.5) points.bottomRight = points.topRight.shift(270, frontPocketSize * 1.5) - console.log({ wpoints: JSON.parse(JSON.stringify(points)) }) points.bottomLeftCornerUp = points.bottomLeft.shift(90, frontPocketSize / 4) points.bottomLeftCornerUpCp1 = points.bottomLeftCornerUp.shift(270, (frontPocketSize / 4) * c) @@ -91,9 +56,24 @@ export const pocket = { .line(points.topLeft) .close() .attr('class', 'fabric') + + paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa') + } else { + paths.frontPocketSeam.setClass('fabric') + + paths.sa = paths.frontPocketSeamSA.offset(sa).close().attr('class', 'fabric sa') + + paths.frontPocket.unhide().setClass('mark') + + macro('cutonfold', { + from: points.frontPocketBottomRight, + to: points.frontPocketTopRight, + }) } - points.title = points.topLeft.shift(270, 75).shift(0, 50) + store.cutlist.addCut({ cut: 2, from: 'lining' }) + + points.title = points.frontPocketTopLeft.shift(270, 75).shift(0, 50) macro('title', { nr: 3, at: points.title, @@ -107,66 +87,36 @@ export const pocket = { .attr('data-text', 'Waralee') .attr('data-text-class', 'center') - console.log({ points: JSON.parse(JSON.stringify(points)), frontPocketSize: frontPocketSize }) - if ('welt' == options.frontPocketStyle) { - macro('cutonfold', { - from: points.topLeft, - to: points.bottomLeft, - margin: 5, - offset: 10, - id: 'cof', - }) - } - if (sa) { - if ('welt' == options.frontPocketStyle) { - paths.sa = new Path() - .move(points.bottomLeft) - .join( - new Path() - .move(points.bottomLeft) - .curve(points.bottomLeftCP, points.bottomRightCP, points.bottomRight) - .line(points.topRight) - .line(points.topLeft) - .offset(sa) - ) - .line(points.topLeft) - .attr('class', 'fabric sa') - } else { - paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa') - } - } - - if ('welt' != options.frontPocketStyle) { macro('hd', { id: 1, - from: points.topLeft, - to: points.topRight, - y: points.topLeft.y + 15, + from: points.frontPocketTopLeft, + to: points.frontPocketTopRight, + y: points.frontPocketTopLeft.y - sa - 15, }) macro('hd', { id: 2, - from: points.bottomLeft, - to: points.bottomRight, - y: points.bottomRight.y, + from: points.frontPocketBottomLeft, + to: points.frontPocketBottomRight, + y: points.frontPocketBottomRight.y + sa + 15, }) macro('vd', { id: 3, - from: points.topLeft, - to: points.bottomLeft, - x: points.topLeft.x + 15, + from: points.frontPocketBottomLeft, + to: points.frontPocketTopLeft, + x: points.frontPocketBottomLeft.x - sa - 15, }) macro('vd', { id: 4, - from: points.topRight, - to: points.bottomRight, - x: points.bottomRight.x, + from: points.frontPocketTopRight, + to: points.frontPocketBottomRight, + x: points.frontPocketBottomRight.x + 15, }) macro('vd', { id: 5, - from: points.bottomRight, - to: points.bottomLeft, - x: points.bottomRight.x, + from: points.frontPocketBottomRight, + to: points.frontPocketBottomLeft, + x: points.frontPocketBottomLeft.x - sa - 15, }) } else { macro('hd', { @@ -177,8 +127,8 @@ export const pocket = { }) macro('vd', { id: 7, - from: points.topLeft, - to: points.bottomLeftCornerOver, + from: points.bottomLeftCornerOver, + to: points.topLeft, x: points.bottomLeftCornerOver.x, }) } diff --git a/designs/waralee/src/waistband.mjs b/designs/waralee/src/waistband.mjs index 18766fea108..0e3c5d294d9 100644 --- a/designs/waralee/src/waistband.mjs +++ b/designs/waralee/src/waistband.mjs @@ -31,7 +31,7 @@ function waraleeWaistband( switch (type) { case 'waistBandFront': if (false == options.separateWaistband && 'welt' == options.frontPocketStyle) { - return part + return part.hide() } partNr = 9 waistBandLength = waistBandLengthFront * 2 @@ -39,7 +39,7 @@ function waraleeWaistband( case 'waistBandBack': if (false == options.separateWaistband && 'welt' == options.frontPocketStyle) { - return part + return part.hide() } partNr = 10 waistBandLength = waistBandLengthBack * 2 @@ -80,8 +80,12 @@ function waraleeWaistband( return part.hide() } + store.cutlist.addCut({ cut: 1, from: 'fabric' }) + points.tl = new Point(0, 0) points.bl = new Point(0, waistBandLength) + points.tm = new Point(waistBand, 0) + points.bm = new Point(waistBand, waistBandLength) points.tr = new Point(waistBand * 2, 0) points.br = new Point(waistBand * 2, waistBandLength) @@ -93,13 +97,15 @@ function waraleeWaistband( .line(points.br) .close() + paths.fold = new Path() + .move(points.tm) + .line(points.bm) + .attr('class', 'fabric dotted') + .setText('fold') + if (sa) paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa') - console.log({ - part: type, - points: JSON.parse(JSON.stringify(points)), - paths: JSON.parse(JSON.stringify(paths)), - }) + store.cutlist.addCut({ cut: 1, from: 'fabric' }) points.title = new Point(waistBand, waistBandLength * 0.2) macro('title', { @@ -116,9 +122,9 @@ function waraleeWaistband( macro('hd', { id: 'w', - from: points.tr, - to: points.tl, - y: points.tl.y + sa + 10, + from: points.tl, + to: points.tr, + y: points.tl.y - sa - 10, }) macro('vd', { id: 'h',