Merge pull request #3666 from BenJamesBen/cutlist-updates
fix(plugin-cutlist, plugin-test, workbench): Cutting layout-related fixes
This commit is contained in:
commit
ab1cf712c1
3 changed files with 4 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue