diff --git a/plugins/plugin-cutlist/src/index.mjs b/plugins/plugin-cutlist/src/index.mjs index 2ac39995683..7400a3862cd 100644 --- a/plugins/plugin-cutlist/src/index.mjs +++ b/plugins/plugin-cutlist/src/index.mjs @@ -42,7 +42,7 @@ function addCut(store, so = {}) { return store } const path = ['cutlist', partName, 'materials', material] - const existing = store.get(path) || [] + const existing = store.get(path, []) store.set(path, existing.concat({ cut, identical, bias, ignoreOnFold })) return store diff --git a/plugins/plugin-title/src/index.mjs b/plugins/plugin-title/src/index.mjs index 9f8d1d840eb..73c138e2ba2 100644 --- a/plugins/plugin-title/src/index.mjs +++ b/plugins/plugin-title/src/index.mjs @@ -79,7 +79,7 @@ export const plugin = { } // Cut List instructions - const partCutlist = store.get(['cutlist', part.name]) + const partCutlist = store.get(['cutlist', part.name], []) // if there's a cutlist and it should be included if (so.cutlist && partCutlist?.materials) { // get the default cutonfold diff --git a/sites/shared/components/workbench/layout/cut/plugin-cut-layout.mjs b/sites/shared/components/workbench/layout/cut/plugin-cut-layout.mjs index 686f56dacc7..e70e1ae5371 100644 --- a/sites/shared/components/workbench/layout/cut/plugin-cut-layout.mjs +++ b/sites/shared/components/workbench/layout/cut/plugin-cut-layout.mjs @@ -167,9 +167,10 @@ export const cutLayoutPlugin = function (material, grainAngle) { if (partGrain === undefined) return // the amount to rotate is the difference between this part's grain angle (as drafted) and the fabric's grain angle - let toRotate = Math.abs(grainAngle - partGrain) + let toRotate = grainAngle - partGrain // don't over rotate if (toRotate >= 180) toRotate -= 180 + else if (toRotate <= -180) toRotate += 180 // if there's no difference, don't rotate if (toRotate === 0) return