Hi, I have been trying to use the Kiri:Moto API locally in a react app. The kiri engine seems to load properly but once it reaches the slice() function it seems to get hung up. No errors are logged. I have made copies of kiri_pool.js and kiri_work.js as was suggested in Javascript Slicing API Live Tester - #7 by cjsboliveira, but it doesn’t seem to solve the issue and seems to create import conflics.
Any help would be greatly appreciated!
is there an URL where I can load this and look at the errors?
Hi Stewart! Thanks for the quick reply and sorry for the delay. Yes here is a URL where you can see the engine running. You have to click the download code button for it to run
https://alzatin.github.io/Abundance/run/alzatin/test_gcode
I’m actually not getting any alerts or errors anymore but the slicing never seems to finish. Here’s the code running if that’s helpful.
const runKirimoto = (kiriEngine) => {
console.log("kiriEngine");
console.log(kiriEngine);
if (!kiriEngine) {
console.error("Kiri:Moto engine is not initialized yet.");
return;
}
kiriEngine
.setListener((message) => {
console.log("Kiri:Moto Message:", message);
if (message.type === "progress") {
console.log(`Progress: ${message.progress * 100}%`);
}
})
.load("/Abundance/Simple_cube.stl") // Replace with your STL file path
.then((eng) => {
console.log("STL file loaded");
return eng.setProcess({
sliceShells: 1,
sliceFillSparse: 0.1,
sliceTopLayers: 1,
sliceBottomLayers: 1,
});
})
.catch((error) => {
console.error("Error loading STL file:", error);
})
.then((eng) => {
console.log("Process parameters set");
return eng.setDevice({
gcodePre: ["M82", "M104 S220"],
gcodePost: ["M107"],
});
})
.then((eng) => eng.slice())
.then((eng) => {
console.log("Slicing completed");
return eng.prepare();
})
.then((eng) => {
console.log("Preparation completed");
return eng.export();
})
.then((gcode) => {
console.log("GCode generated:", gcode);
})
.catch((error) => {
console.error("Kiri:Moto Error:", error);
});
};
type or paste code here
Ah yeah it must be new since I deployed it since for it to have the correct path for it would have to be “Abundance/code/kiri_work.js” but since the path is created in the engine.js I don’t have the chance to modify the path .
The script runs correctly on my local machine, but I get an unexpected token error, which might just refer to the HTML tags.
Maybe modifying the kiri_work file not to create a whole HTML doc, but to simply load the script would solve it? Not sure if you have any insight on this.
Thank you !