Cloud-CNC / cura-wasm

Cura Engine powered by Web Assembly (WASM)
https://cloud-cnc.github.io
Other
61 stars 17 forks source link

Speed setting not taking effect #15

Closed JayEnaR closed 2 years ago

JayEnaR commented 2 years ago

Hi, thanks for the time and effort in creating this library. When I pass in the parameter to change the speed, there is no difference in the print time output.

command: 'slice -j definitions/fdmprinter.def.json -o Model.gcode -s speed_print=120 -s layer_height=0.2 -l Model.stl'

using the resolveDefinition also does not seem to work when using overrides either: definition: resolveDefinition('ultimaker3'), overrides: [ { scope: null, key: 'speed_print', value: '110' } ],

Is this a bug, or am I doing something wrong? Also, the esolveDefinition('fdmprinter') returns null. Also, how do I pass in a custom def.json?

Wakeful-Cloud commented 2 years ago

I'm sorry to hear you're having difficulties.

When I pass in the parameter to change the speed, there is no difference in the print time output

Your command looks correct, but have you tried running it with the native Cura Engine with the same definitions/printer?

using the resolveDefinition also does not seem to work when using overrides either

Try omitting the scope option or set it to e0.

If neither of the above work, try enabling verbose logging and see what command Cura Engine is invoked with.

[r]esolveDefinition('fdmprinter') returns null

fdmprinter and fdmextruder are special. Because virtually all printers rely on them, they're bundled into cura-wasm - not cura-wasm-definitions

Also, how do I pass in a custom def.json?

This isn't really a supported feature in V1, but should be easy to do in V2 (Still under development). That said, you can pass any value that satisfies the CombinedDefinition type to the definition property in the Cura WASM constructor and it will get stringified and written to the filesystem (See worker.ts:85). You could probably even get away with the following (Though I haven't tested it):

{
  "extruders": [
    "arbitrary, definitely not JSON content" //Written to /definitions/extruder-0.def.json
    "more non-JSON content" //Written to /definitions/extruder-1.def.json
  ],
  "printer": "Binary data: \u0048\u0065\u006c\u006c\u006f\u002c\u0020\u0077\u006f\u0072\u006c\u0064\u0021" //Written to /definitions/printer.def.json
}

The important thing is that all definitions (Excluding fdmprinter and fdmextruder) are bundled into one (See cura-wasm-definitions/index.ts:93 for the algorithm).

JayEnaR commented 2 years ago

Sorry for the late reply. It seems the order of the command is correct. So, what worked was using the fdmpinter.def.json but making sure that the -s commands used have no child elements.