forked from cnctotalusa/Deepnest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrobot.js
More file actions
26 lines (24 loc) · 862 Bytes
/
Copy pathrobot.js
File metadata and controls
26 lines (24 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const waitFor = (predicate) =>
new Promise(async (resolve) => {
while (!(await predicate())) {
await new Promise((resolve) => setTimeout(resolve, 500));
}
resolve();
});
(async () => {
const wait = waitFor(
() =>
document.querySelector("#partscroll > table > tbody").children.length > 0
);
document.getElementById("import").click();
await wait;
document.getElementById("addsheet").click();
document.getElementById("sheetwidth").value = "$width";
document.getElementById("sheetheight").value = "$height";
document.getElementById("confirmsheet").click();
document.getElementById("startnest").click();
await waitFor(() => document.getElementById("nestlist").children.length > 0);
document.getElementById("export").click();
document.getElementById("exportsvg").click();
return window.DeepNest.nests;
})();