Closed benzend closed 3 years ago
@benzend Can you post the error message?
PS: sometimes debugging breakpoints don't work if you place them on empty lines.
@Wakeful-Cloud
I went through looking at how you create your resolvePrinter
function which is used in your resolveDefinition
function. I noticed that you do something special for "fdmprinter" and "fdmextruder".
I'm guessing if I simply don't add the definition specification it should default to "fdmprinter" and "fdmextruder"? Because it worked and I'm going to test the print.
Also here is the error that I normally get:
Update:
My printer will just sit there and extrude, not moving anywhere. Here are some of the overrides that I'm using:
{ scope: "e0", key: "cool_fan_enabled", value: "False" },
{ scope: "e0", key: "cool_fan_full_at_height", value: "1" },
{ scope: "e0", key: "infill_before_walls", value: "False" },
{ scope: "e0", key: "infill_overlap", value: "40" },
{ scope: "e0", key: "infill_sparse_density", value: "20" },
{ scope: "e0", key: "layer_0_z_overlap", value: "0.15" },
Hopefully they're in the right format, as in TS, the values are only accepted as strings.
Lastly, I attempted adding the setting "verbose" to true in the slicer. I received this warning if that matters.
Also, I found something cool you can do, I'm not exactly what the possibilities are but I noticed you can only add one metadata key-val on the printer part.
Am I able to put more meta on there or is the limit rather than just TypeScript complaining?
Also, I know you were saying using debugger
sometimes doesn't get caught, but I also attempted to comment out the code and leave just the slicer and array buffer and ended up getting the same results, and still, really only for the "fdmprinter" definition.
I've tried using 'ultimaker2', 'ultimaker3', and other definitions but the one that I've found that doesn't work is 'fdmprinter'. I noticed that you do something special for "fdmprinter" and "fdmextruder".
Correct, because every printer definition relies on fdmprinter
and/or fdmextruder
, these are shipped with cura-wasm itself while other definitions are shipped in cura-wasm-definitions
. You can see here that fdmprinter
and fdmextruder
(Primary definitions) are loaded into the virtual filesystem separately from each other and everything else (As opposed to resolved/secondary definitions which are combined into a single JSON document and loaded as a single file). If you examine how the CLI arguments are generated, you'll see that Cura WASM expects the secondary definition to be located at definitions/printer.def.json
. So when you use either fdmprinter
or fdmextruder
(Which resolve to undefined
as you saw), an empty file is created at definitions/printer.def.json
(Instead of a secondary definition). This likely tricks Cura Engine into slicing the STL but yielding bad GCODE (Probably why your printer didn't move). Having the definition split between two repositories is going to change in V2, but in the meantime as long as you set the definition file (-j
argument) to definitions/fdmprinter.def.json
or definitions/fdmextruder.def.json
(Via the command
option), you should be fine.
Hopefully they're in the right format, as in TS, the values are only accepted as strings.
This is because all options are converted to CLI arguments (Which don't have data types).
Am I able to put more meta on there or is the limit rather than just TypeScript complaining?
You're able to define arbitrary data (Which will be stringified); only the fields necessary for Cura WASM internals are defined.
If you're still getting an error, please post more than just the promise rejection message (Even if heavily redacted), thanks!
Thank you for the elegant response! Very helpful!
Just so I'm getting this straight, if I'm using fdmprinter
that means that I can only use the command option inside of the CuraWASM class?
So something like this should work:
const slicer = new CuraWASM({
command: "slice -j definitions/fdmprinter.def.json -o Model.gcode -s my_override -l Model.stl",
});
Also thank you again! This piece of software is honestly really cool especially since it's in TypeScript. I'd love to run a PR but I honestly have no idea where to start.
Yes, that command should work. Thanks for your interest in Cura WASM!
I've tried using 'ultimaker2', 'ultimaker3', and other definitions but the one that I've found that doesn't work is 'fdmprinter'.
I've attempted to use it with overrides, without overrides, and even tested it with a command. It just doesn't seem to work correctly.
I've narrowed it down to the slicer.slice() function. And as an example so that you know that I'm using it correctly: