1
0
Fork 0

Paperless

This commit is contained in:
Wouter van Wageningen 2022-07-28 21:47:47 +00:00
parent 16b147a2d8
commit 694b3e8044
5 changed files with 239 additions and 132 deletions

View file

@ -8,9 +8,19 @@ export default {
department: '', department: '',
type: '', type: '',
difficulty: 2, difficulty: 2,
tags: [ ], tags: [],
optionGroups: { optionGroups: {
options: ['size','type','legWidth','legLength','neckWidth','legTaper','bottomTopLegRatio','bottomLegReduction'], options: [
'size',
'type',
'legWidth',
'legLength',
'neckWidth',
'legTaper',
'bottomTopLegRatio',
'bottomLegReduction',
'bottomLegReductionPlushy',
],
}, },
measurements: [], measurements: [],
dependencies: { dependencies: {
@ -18,21 +28,32 @@ export default {
eye1: 'headSection0', eye1: 'headSection0',
eye2: 'headSection0', eye2: 'headSection0',
legSection0: 'headSection0', legSection0: 'headSection0',
legSection1: 'headSection1'}, legSection1: 'headSection1',
},
inject: {}, inject: {},
hide: [], hide: [],
parts: ['headSection0','headSection1','legSection0','legSection1','eye0','eye1','eye2'], parts: ['headSection0', 'headSection1', 'legSection0', 'legSection1', 'eye0', 'eye1', 'eye2'],
options: { options: {
sizeConstant: 200, sizeConstant: 200,
size: { pct: 100, min: 5, max: 500 }, size: { pct: 100, min: 5, max: 500 },
type: { dflt: 'octoplushy', list: ['octoplushy','octopus','squid'] }, type: { dflt: 'octoplushy', list: ['octoplushy', 'octopus', 'squid'] },
legWidth: { pct: 15, min: 10, max: 30 }, legWidth: { pct: 15, min: 10, max: 30 },
legLength: { pct: 200, min: 100, max: 500 }, legLength: { pct: 200, min: 100, max: 500 },
neckWidth: { pct: 25, min: 25, max: 45 }, neckWidth: { pct: 25, min: 25, max: 45 },
legTaper: { pct: 25, min: 0, max: 50 }, legTaper: { pct: 25, min: 0, max: 50 },
bottomTopLegRatio: { pct: 87, min: 75, max: 100 }, bottomTopLegRatio: { pct: 87, min: 75, max: 100 },
bottomLegReduction: { pct: 80, min: 75, max: 125 }, bottomLegReduction: {
pct: 90,
min: 75,
max: 125,
hide: ({ options }) => options.type == 'octoplushy',
},
bottomLegReductionPlushy: {
pct: 80,
min: 75,
max: 125,
hide: ({ options }) => options.type != 'octoplushy',
},
}, },
} }

View file

@ -26,15 +26,14 @@ export default function (partNumber, part) {
let sectionWidth = store.get('sectionWidth') let sectionWidth = store.get('sectionWidth')
let eyeSize = sectionWidth / 1.5 let eyeSize = sectionWidth / 1.5
let logoScale = .25 let logoScale = 0.25
let titleScale = .25 let titleScale = 0.25
if (partNumber == 1) { if (partNumber == 1) {
eyeSize *= 0.65 eyeSize *= 0.65
logoScale = .15 logoScale = 0.15
titleScale = .16 titleScale = 0.16
} }
if (partNumber < 2) { if (partNumber < 2) {
points.top = new Point(0, -1 * (eyeSize / 2)) points.top = new Point(0, -1 * (eyeSize / 2))
points.left = new Point(-1 * (eyeSize / 2), 0) points.left = new Point(-1 * (eyeSize / 2), 0)
@ -59,20 +58,18 @@ export default function (partNumber, part) {
.close() .close()
.attr('class', 'fabric') .attr('class', 'fabric')
.setRender(true) .setRender(true)
points.logo = points.top.shiftFractionTowards( points.logo = points.top.shiftFractionTowards(points.bottom, 0.3)
points.bottom,
0.3
)
points.titleAnchor = points.bottom points.titleAnchor = points.bottom
.shiftFractionTowards(points.top, 0.25).shift(180,eyeSize/10) .shiftFractionTowards(points.top, 0.25)
.shift(180, eyeSize / 10)
} else { } else {
logoScale = .35 logoScale = 0.35
titleScale = .25 titleScale = 0.25
let eyeBrowWidth = eyeSize * 0.375 let eyeBrowWidth = eyeSize * 0.375
let eyeCirc = (eyeSize +(eyeBrowWidth *2))* Math.PI let eyeCirc = (eyeSize + eyeBrowWidth * 2) * Math.PI
points.tl = new Point(0, 0) points.tl = new Point(0, 0)
points.tr = points.tl.shift(0, eyeCirc) points.tr = points.tl.shift(0, eyeCirc)
points.bl = points.tl.shift(270, eyeBrowWidth *2) points.bl = points.tl.shift(270, eyeBrowWidth * 2)
points.br = points.bl.shift(0, eyeCirc) points.br = points.bl.shift(0, eyeCirc)
paths.eye = new Path() paths.eye = new Path()
@ -85,46 +82,49 @@ export default function (partNumber, part) {
.attr('class', 'fabric') .attr('class', 'fabric')
.setRender(true) .setRender(true)
points.logo = points.tl.shiftFractionTowards( points.logo = points.tl
points.bl, .shiftFractionTowards(points.bl, 0.5)
0.5 .shiftFractionTowards(points.br, 0.3)
).shiftFractionTowards( points.titleAnchor = points.tr
points.br, 0.3) .shiftFractionTowards(points.br, 0.5)
points.titleAnchor = points.tr.shiftFractionTowards( .shiftFractionTowards(points.bl, 0.3)
points.br,
0.5
).shiftFractionTowards(
points.bl, 0.3)
} }
if (complete) { if (complete) {
snippets.logo = new Snippet('logo', points.logo).attr('data-scale', logoScale) snippets.logo = new Snippet('logo', points.logo).attr('data-scale', logoScale)
macro('title', { macro('title', {
at: points.titleAnchor, at: points.titleAnchor,
nr: 3 + partNumber * 3, nr: 3 + partNumber * 3,
title: (partNumber == 2 ? 'eyebrow' : partNumber == 1 ? 'pupil' : 'eye' ), title: partNumber == 2 ? 'eyebrow' : partNumber == 1 ? 'pupil' : 'eye',
scale: titleScale scale: titleScale,
}) })
if (sa) { if (sa) {
paths.sa = paths.eye.offset(Math.min(sa,6)).attr('class', 'fabric sa') paths.sa = paths.eye.offset(Math.min(sa, 6)).attr('class', 'fabric sa')
} }
} }
// Paperless? // Paperless?
// if (paperless) { if (paperless) {
// macro('hd', { if (partNumber < 2) {
// from: points.bottomLeft, macro('hd', {
// to: points.bottomRight, from: points.left,
// y: points.bottomLeft.y + sa + 15, to: points.right,
// }) y: points.top.y - sa,
// macro('vd', { })
// from: points.bottomRight, } else {
// to: points.topRight, macro('hd', {
// x: points.topRight.x + sa + 15, from: points.tl,
// }) to: points.tr,
// } y: points.tl.y - sa,
})
macro('vd', {
from: points.bl,
to: points.tl,
x: points.tl.x - sa,
})
}
}
return part return part
} }

View file

@ -44,15 +44,14 @@ export default function (partNumber, part) {
} }
let skirtWidth = let skirtWidth =
(options.type == 'octopus' ? 2 : options.type == 'octoplushy' ? 0.7 : 1) * sectionWidth (options.type == 'octopus' ? 2 : options.type == 'octoplushy' ? 0.7 : 1) * sectionWidth
// legWidth = skirtWidth > legWidth ? legWidth : skirtWidth
skirtWidth = skirtWidth < legAdjustedWidth ? legAdjustedWidth : skirtWidth skirtWidth = skirtWidth < legAdjustedWidth ? legAdjustedWidth : skirtWidth
console.log({ w: w }) // console.log({ w: w })
console.log({ sectionWidth: sectionWidth }) // console.log({ sectionWidth: sectionWidth })
console.log({ neckWidth: neckWidth }) // console.log({ neckWidth: neckWidth })
console.log({ legAdjustedWidth: w * options.legWidth * options.bottomTopLegRatio }) // console.log({ legAdjustedWidth: w * options.legWidth * options.bottomTopLegRatio })
console.log({ toplegWidth: legAdjustedWidth }) // console.log({ toplegWidth: legAdjustedWidth })
console.log({ legLength: legLength }) // console.log({ legLength: legLength })
points.topLeft = new Point(-1 * w, -1 * h) points.topLeft = new Point(-1 * w, -1 * h)
points.topRight = new Point(w, -1 * h) points.topRight = new Point(w, -1 * h)
@ -61,14 +60,8 @@ export default function (partNumber, part) {
points.left = new Point(-1 * w, 0) points.left = new Point(-1 * w, 0)
points.right = new Point(w, 0) points.right = new Point(w, 0)
// points.sectionTop = points.topLeft.shiftFractionTowards(points.topRight, 1 / sections / 2)
points.sectionTop = new Point(0, -1 * h) points.sectionTop = new Point(0, -1 * h)
// points.sectionBottom = points.bottomLeft.shiftFractionTowards(
// points.bottomRight,
// 1 / sections / 2
// )
points.sectionBottom = new Point(0, h) points.sectionBottom = new Point(0, h)
// let sectionMid = points.left.shiftFractionTowards(points.sectionTop, 0.5)
points.sectionLeft = new Point((-1 * sectionWidth) / 2, 0) points.sectionLeft = new Point((-1 * sectionWidth) / 2, 0)
let sectionMid = points.sectionLeft.shiftFractionTowards(points.sectionTop, 0.5) let sectionMid = points.sectionLeft.shiftFractionTowards(points.sectionTop, 0.5)
@ -160,24 +153,7 @@ export default function (partNumber, part) {
(points.skirtTopMiddle.y - points.skirtBottomLeft3.y) / 2 (points.skirtTopMiddle.y - points.skirtBottomLeft3.y) / 2
) )
} }
// points.skirtBottomLeft = points.skirtTopMiddle.shift(270 - 360 / sections / 2, skirtWidth / 2 / Math.sin(utils.deg2rad(360 / sections / 2)))
points.skirtBottomLeft = points.skirtBottomLeft3.clone() points.skirtBottomLeft = points.skirtBottomLeft3.clone()
// paths.leftTemp = new Path().move(points.skirtBottomLeft).line(points.skirtBottomLeftTempCp2 )
// if (options.type == 'octopus') {
// skirtWidth = 3
// points.skirtBottomLeft = utils.beamIntersectsX(
// points.sectionBottomLeft,
// points.sectionBottomLeft.shift(180 + 45, 100),
// points.sectionLeft.x - neckWidth * 1.5
// )
// } else {
// points.skirtBottomLeft = utils.beamIntersectsX(
// points.sectionBottomLeft,
// points.sectionBottomLeft.shift(180 + 45, 100),
// points.sectionLeft.x
// )
// }
points.legTopLeft = utils.beamIntersectsX( points.legTopLeft = utils.beamIntersectsX(
points.skirtBottomLeft, points.skirtBottomLeft,
points.skirtBottomLeft.shift(270 + 30, 100), points.skirtBottomLeft.shift(270 + 30, 100),
@ -414,15 +390,15 @@ export default function (partNumber, part) {
.close() .close()
.attr('class', 'fabric') .attr('class', 'fabric')
paths.seam = new Path() // paths.box = new Path()
.move(points.topLeft) // .move(points.topLeft)
.line(points.bottomLeft) // .line(points.bottomLeft)
.line(points.bottomRight) // .line(points.bottomRight)
.line(points.topRight) // .line(points.topRight)
.line(points.topLeft) // .line(points.topLeft)
.close() // .close()
.attr('class', 'fabric') // .attr('class', 'fabric')
.setRender(false) // .setRender(false)
// Complete? // Complete?
if (complete) { if (complete) {
@ -529,16 +505,108 @@ export default function (partNumber, part) {
// Paperless? // Paperless?
if (paperless) { if (paperless) {
macro('hd', { macro('hd', {
from: points.bottomLeft, from: points.sectionLeft,
to: points.bottomRight, to: points.sectionRight,
y: points.bottomLeft.y + sa + 15, y: points.sectionTop.y - sa,
})
macro('hd', {
from: points.legTopLeft,
to: points.legTopRight,
y: points.legTopRight.y,
})
macro('hd', {
from: points.legBottomLeft,
to: points.legBottomRight,
y: points.legBottom.y + sa + 10,
})
macro('vd', {
from: points.sectionTop,
to: points.sectionRight,
x: points.skirtBottomRight.x + sa + 10,
}) })
macro('vd', { macro('vd', {
from: points.bottomRight, from: points.sectionTop,
to: points.topRight, to: points.sectionBottomRight,
x: points.topRight.x + sa + 15, x: points.skirtBottomRight.x + sa + 20,
})
macro('vd', {
from: points.sectionTop,
to: points.skirtBottomRight,
x: points.skirtBottomRight.x + sa + 30,
})
macro('vd', {
from: points.sectionTop,
to: points.legBottom,
x: points.skirtBottomRight.x + sa + 40,
})
if (options.type == 'octopus') {
macro('hd', {
from: points.skirtBottomLeft,
to: points.skirtBottomRight,
y: points.skirtBottomRight.y,
})
macro('vd', {
from: points.skirtBottomRight,
to: points.legTopRight,
x: points.skirtBottomRight.x + sa + 30,
}) })
} }
if (options.type == 'squid') {
macro('vd', {
from: points.legTopLeft,
to: points.sectionBottomLeft,
x: points.legTopLeft.x - sa - 10,
})
macro('vd', {
from: points.sectionBottomLeft,
to: points.sectionMidLeft,
x: points.legTopLeft.x - sa - 10,
})
if (partNumber == 1) {
macro('hd', {
from: points.tentacleLeft,
to: points.tentacleRight,
y: points.tentacleRight.y,
})
macro('hd', {
from: points.finSeam,
to: points.sectionTop,
y: points.sectionTop.y,
})
macro('hd', {
from: points.finSeam,
to: points.finSection,
y: points.finSection.y,
})
macro('hd', {
from: points.finFold,
to: points.finSection,
y: points.finFold.y,
})
macro('vd', {
from: points.legBottom,
to: points.tentacleLeft,
x: points.tentacleLeft.x - sa - 10,
})
macro('vd', {
from: points.finSeam,
to: points.sectionTop,
x: points.finSeam.x - sa,
})
macro('vd', {
from: points.finFold,
to: points.sectionTop,
x: points.finSeam.x - sa - 10,
})
macro('vd', {
from: points.finSection,
to: points.sectionTop,
x: points.finSeam.x - sa - 20,
})
}
}
}
return part return part
} }

View file

@ -10,15 +10,14 @@ const Pattern = new freesewing.Design(config, plugins)
// Attach the draft methods to the prototype // Attach the draft methods to the prototype
// Pattern.prototype.draftHeadSection = draftHeadSection // Pattern.prototype.draftHeadSection = draftHeadSection
for( let i = 0; i < 2; i ++ ){ for (let i = 0; i < 2; i++) {
Pattern.prototype[`draftHeadSection${i}`] = (part) => draftHeadSection(i, part) Pattern.prototype[`draftHeadSection${i}`] = (part) => draftHeadSection(i, part)
} }
for( let i = 0; i < 2; i ++ ){ for (let i = 0; i < 2; i++) {
Pattern.prototype[`draftLegSection${i}`] = (part) => draftLegSection(i, part) Pattern.prototype[`draftLegSection${i}`] = (part) => draftLegSection(i, part)
} }
for( let i = 0; i < 3; i ++ ){ for (let i = 0; i < 3; i++) {
Pattern.prototype[`draftEye${i}`] = (part) => draftEye(i, part) Pattern.prototype[`draftEye${i}`] = (part) => draftEye(i, part)
} }
export default Pattern export default Pattern

View file

@ -1,6 +1,3 @@
// import mirror from '@freesewing/plugin-mirror'
// import { Store } from '@material-ui/icons'
export default function (partNumber, part) { export default function (partNumber, part) {
console.log({ part: part }) console.log({ part: part })
const { const {
@ -45,7 +42,7 @@ export default function (partNumber, part) {
} }
break break
case 'octoplushy': case 'octoplushy':
legLength *= options.bottomLegReduction legLength *= options.bottomLegReductionPlushy
} }
points.legMiddle = new Point(0, 0) points.legMiddle = new Point(0, 0)
@ -257,39 +254,61 @@ export default function (partNumber, part) {
} }
if (paperless) { if (paperless) {
// macro('hd', { macro('hd', {
// from: points.topFin01, from: points.legTopLeft,
// to: points.topFinRight, to: points.legTopRight,
// y: points.topFin01.y - sa - 10, y: points.legMiddle.y - sa,
// }) })
// macro('hd', { macro('hd', {
// from: points.topFin03, from: points.legBottomLeft,
// to: points.topFinRight, to: points.legBottomRight,
// y: points.topFin03.y + sa + 20, y: points.legBottom.y + sa + 10,
// })
// macro('hd', {
// from: points.topFinLeft,
// to: points.topFinRight,
// y: points.topFin03.y + sa + 10,
// })
macro('vd', {
from: points.legMiddle,
to: points.legBottom,
x: points.legTopLeft.x - sa - 10,
}) })
console.log( {legLength: points.legMiddle.dist( points.legBottom ) })
// macro('vd', {
// from: points.topFin01,
// to: points.topFinInsideBottom,
// x: points.topFin02.x +sa + 10,
// })
// macro('vd', {
// from: points.topFinInsideTop,
// to: points.topFin01,
// x: points.topFinLeft.x -sa - 20,
// })
}
macro('vd', {
from: points.legBottom,
to: points.legMiddle,
x: points.skirtLeft.x - sa - 20,
})
if (options.type == 'octopus') {
macro('hd', {
from: points.skirtLeft,
to: points.skirtRight,
y: points.skirtRight.y,
})
macro('vd', {
from: points.skirtLeft,
to: points.legMiddle,
x: points.skirtLeft.x - sa - 10,
})
macro('vd', {
from: points.legTopLeft,
to: points.skirtLeft,
x: points.skirtLeft.x - sa - 10,
})
} else {
macro('vd', {
from: points.legTopLeft,
to: points.legMiddle,
x: points.skirtLeft.x - sa - 10,
})
}
if (options.type == 'squid') {
if (partNumber == 1) {
macro('hd', {
from: points.tentacleLeft,
to: points.tentacleRight,
y: points.tentacleRight.y,
})
macro('vd', {
from: points.legBottom,
to: points.tentacleLeft,
x: points.tentacleLeft.x - sa - 10,
})
}
}
}
} }
return part return part