fix (cutlist) edits to work with plugin-mirror's new strictness
This commit is contained in:
parent
0d677367b8
commit
0cbc0856f4
5 changed files with 10 additions and 10 deletions
|
@ -177,6 +177,7 @@ export const sleevecap = {
|
||||||
for (const path in paths) delete paths[path]
|
for (const path in paths) delete paths[path]
|
||||||
delete snippets.logo
|
delete snippets.logo
|
||||||
macro('title', false)
|
macro('title', false)
|
||||||
|
macro('cutonfold', false)
|
||||||
|
|
||||||
store.set('sleeveFactor', 1)
|
store.set('sleeveFactor', 1)
|
||||||
let run = 0
|
let run = 0
|
||||||
|
|
|
@ -38,7 +38,7 @@ export function Store(methods = []) {
|
||||||
logs.warning.push(...data)
|
logs.warning.push(...data)
|
||||||
},
|
},
|
||||||
error: function (...data) {
|
error: function (...data) {
|
||||||
if (typeof window !== 'undefined') console.error(...data)
|
if (typeof window !== 'undefined') console.error(...data[0])
|
||||||
logs.error.push(...data)
|
logs.error.push(...data)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ function getCutFabrics(store, settings) {
|
||||||
|
|
||||||
const fabrics = []
|
const fabrics = []
|
||||||
list.forEach((partName) => {
|
list.forEach((partName) => {
|
||||||
if (!cutlist[partName].materials) {
|
if (!cutlist[partName]?.materials) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for (var m in cutlist[partName].materials) {
|
for (var m in cutlist[partName].materials) {
|
||||||
|
|
|
@ -20,7 +20,8 @@ const mirrorGen = (start, end) => {
|
||||||
point.y = vNom / denom
|
point.y = vNom / denom
|
||||||
|
|
||||||
const mirrorCount = Number(point.attributes.get('data-mirrored'))
|
const mirrorCount = Number(point.attributes.get('data-mirrored'))
|
||||||
if (mirrorCount > 0)
|
// some points returned by utils do not have logs
|
||||||
|
if (mirrorCount > 0 && point.log)
|
||||||
point.log.warning(
|
point.log.warning(
|
||||||
`Point ${point.name} was mirrored more than once (${
|
`Point ${point.name} was mirrored more than once (${
|
||||||
mirrorCount + 1
|
mirrorCount + 1
|
||||||
|
|
|
@ -116,7 +116,7 @@ export const cutLayoutPlugin = function (material, grainAngle) {
|
||||||
macro('rotateToGrain', { bias: instruction.bias, grainSpec })
|
macro('rotateToGrain', { bias: instruction.bias, grainSpec })
|
||||||
},
|
},
|
||||||
// mirror the part across the line indicated by cutonfold
|
// mirror the part across the line indicated by cutonfold
|
||||||
mirrorOnFold: ({ fold }, { paths, snippets, macro }) => {
|
mirrorOnFold: ({ fold }, { paths, snippets, macro, points, utils, Point }) => {
|
||||||
// get all the paths to mirror
|
// get all the paths to mirror
|
||||||
const mirrorPaths = []
|
const mirrorPaths = []
|
||||||
for (const p in paths) {
|
for (const p in paths) {
|
||||||
|
@ -139,8 +139,10 @@ export const cutLayoutPlugin = function (material, grainAngle) {
|
||||||
snippetsByType[snip.def] = snippetsByType[snip.def] || []
|
snippetsByType[snip.def] = snippetsByType[snip.def] || []
|
||||||
|
|
||||||
// put the anchor on the list to mirror
|
// put the anchor on the list to mirror
|
||||||
mirrorPoints.push(snip.anchor)
|
const anchorName = `snippetAnchors_${anchorNames++}`
|
||||||
snippetsByType[snip.def].push(`${prefix}_${anchorNames++}`)
|
points[anchorName] = new Point(snip.anchor.x, snip.anchor.y)
|
||||||
|
mirrorPoints.push(anchorName)
|
||||||
|
snippetsByType[snip.def].push(`${prefix}${utils.capitalize(anchorName)}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// mirror
|
// mirror
|
||||||
|
@ -150,10 +152,6 @@ export const cutLayoutPlugin = function (material, grainAngle) {
|
||||||
points: mirrorPoints,
|
points: mirrorPoints,
|
||||||
mirror: fold,
|
mirror: fold,
|
||||||
prefix,
|
prefix,
|
||||||
nameFormat: () => {
|
|
||||||
unnamed++
|
|
||||||
return `${prefix}_${unnamed}`
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// sprinkle the snippets
|
// sprinkle the snippets
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue