1
0
Fork 0

Merge pull request #3666 from BenJamesBen/cutlist-updates

fix(plugin-cutlist, plugin-test, workbench): Cutting layout-related fixes
This commit is contained in:
Joost De Cock 2023-03-19 19:18:42 +01:00 committed by GitHub
commit ab1cf712c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View file

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

View file

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

View file

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