Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export type DeepNestConfig = {
mutationRate: number;
placementType: "gravity" | "box" | "convexhull";
mergeLines: boolean;
// Hole packing toggles
enableHolePlacement?: boolean;
enableHoleInHolePlacement?: boolean;
/**
* ratio of material reduction to laser time. 0 = optimize material only, 1 = optimize laser time only
*/
Expand Down
505 changes: 392 additions & 113 deletions main/background.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions main/deepnest.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ var config = {
threads: 4,
placementType: "gravity",
mergeLines: true,
// hole packing toggles (default on)
enableHolePlacement: true,
enableHoleInHolePlacement: true,
timeRatio: 0.5,
scale: 72,
simplify: false,
Expand Down Expand Up @@ -543,6 +546,14 @@ export class DeepNest {
config.mergeLines = !!c.mergeLines;
}

// hole packing toggles
if (c.enableHolePlacement === true || c.enableHolePlacement === false) {
config.enableHolePlacement = !!c.enableHolePlacement;
}
if (c.enableHoleInHolePlacement === true || c.enableHoleInHolePlacement === false) {
config.enableHoleInHolePlacement = !!c.enableHoleInHolePlacement;
}

if (c.simplify === true || c.simplify === false) {
config.simplify = !!c.simplify;
}
Expand Down
10 changes: 10 additions & 0 deletions main/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,16 @@ <h1>Nesting configuration</h1>
</select>
</dd>

<dt>Enable part-in-hole placement</dt>
<dd>
<input type="checkbox" data-config="enableHolePlacement" />
</dd>

<dt>Enable hole-in-hole placement</dt>
<dd>
<input type="checkbox" data-config="enableHoleInHolePlacement" />
</dd>

<dt>Use rough approximation</dt>
<dd>
<input type="checkbox" data-config="simplify" />
Expand Down
6 changes: 4 additions & 2 deletions main/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ ready(async function () {
mutationRate: 10,
placementType: 'box', // how to place each part (possible values gravity, box, convexhull)
mergeLines: true, // whether to merge lines
enableHolePlacement: true, // allow placing parts into holes of placed parts
enableHoleInHolePlacement: true, // allow nesting into holes of parts that are themselves placed in holes
timeRatio: 0.5, // ratio of material reduction to laser time. 0 = optimize material only, 1 = optimize laser time only
simplify: false,
dxfImportScale: "1",
Expand Down Expand Up @@ -269,7 +271,7 @@ ready(async function () {
}
}

if (['mergeLines', 'simplify', 'useSvgPreProcessor', 'useQuantityFromFileName', 'exportWithSheetBoundboarders', 'exportWithSheetsSpace'].includes(key)) {
if (['mergeLines', 'simplify', 'useSvgPreProcessor', 'useQuantityFromFileName', 'exportWithSheetBoundboarders', 'exportWithSheetsSpace', 'enableHolePlacement', 'enableHoleInHolePlacement'].includes(key)) {
val = i.checked;
}

Expand Down Expand Up @@ -370,7 +372,7 @@ ready(async function () {
else if (i.getAttribute('data-conversion') == 'true') {
i.value = c[i.getAttribute('data-config')] / scale.value;
}
else if (['mergeLines', 'simplify', 'useSvgPreProcessor', 'useQuantityFromFileName', 'exportWithSheetBoundboarders', 'exportWithSheetsSpace'].includes(key)) {
else if (['mergeLines', 'simplify', 'useSvgPreProcessor', 'useQuantityFromFileName', 'exportWithSheetBoundboarders', 'exportWithSheetsSpace', 'enableHolePlacement', 'enableHoleInHolePlacement'].includes(key)) {
i.checked = c[i.getAttribute('data-config')];
}
else {
Expand Down
Loading
Loading