G-code Viewer G2/G3 arc preview
-
Hi all,
i'm facing some issues in previewing own made g-code for a cnc foam cutting machine i'm making.Machine is made of 4 axis named X,Y,U,V. X is right X carriage, Y is right Y carriage, U is X left carriage and V is left Y carriage. Between the carriage there is a hotwire that i use for cutting foam.
I've written a small Autocad macro for outputting custom G-Code from a closed polyline to allow machine control. Since now i've used https://ncviewer.com/ for checking the output g-code and bugfixing the macro.
Now i've tried uploading a sample code to DWC and preview it. The result is different from what i would have expected and from what the ncviewer is showing. Anyone could replicate it? i'm doing something wrong? X Y U V and I,J values seems to be correct checking them against cad drawing.PS: i didn't run the code on the machine so i still don't now if this is only related to the preview or to the duet motion too.
I attach here the result and the gcode:
Gcode:
G0 Y7.67669351816836 V7.67669351816836 G1 X10.460086722869 Y7.67669351816836 U10.460086722869 V7.67669351816836 G2 X111.312729233058 Y56.8157257089499 U111.312729233058 V56.8157257089499 I83.5083390409037 J-43.3278104191889 G2 X103.316129299667 Y28.9066637370007 U103.316129299667 V28.9066637370007 I19.773679663431 J-20.7657599308204 G1 X104.906216011594 Y47.7466616126872 U104.906216011594 V47.7466616126872 G1 X66.0782304671486 Y39.7601877983511 U66.0782304671486 V39.7601877983511 G1 X78.6102154332631 Y24.0166143731538 U78.6102154332631 V24.0166143731538 G1 X101.406493263683 Y11.6125868744677 U101.406493263683 V11.6125868744677 G1 X57.365517020264 Y7.55742399224854 U57.365517020264 V7.55742399224854 G1 X49.3689168105043 Y22.2275719838839 U49.3689168105043 V22.2275719838839 G1 X25.0210598390317 Y9.22719695550413 U25.0210598390317 V9.22719695550413 G1 X10.460086722869 Y7.67669351816836 U10.460086722869 V7.67669351816836 G1 X0 U0 G0 Y0 V0
NCViewer preview:
DWC Preview:
-
@MikeS I can confirm that the code generates the first shape in NC Viewer (although I default to mm instead of inches and so mine looked smaller than yours).
There are not enough lines of code to generate the second shape, so you must have lost a couple at some stage.
-
@MJLew thank you for the feedback. The second image is the same gcode as posted previewed in dwc. I saw the same behaviour with other tests when g2 and g3 are used. The arcs does not always start from the correct point and linear movement are shown.
I tried launching "print" without motors connected and the extruder in the simulation seems to follow the correct path altought it is difficult to reliably say it because arc are not previewed. However these added lines are not followed for sure so i really think that it is the viewer that is not showing the correct path or my codes are somewhat correctly iterpreted by duet firmware and ncviewer but not from the preview. -
@MikeS I'll need to take a deeper look into what is going on with the viewer but it is upset with the U and V params. If you remove them the rendered matches NCViewer.
-
@Sindarius nice! When i get back from work i'll try to export some gcodes without the u and v axes. I'll get back with the results.
-
@MikeS Can you post what firmware version, DWC version and Duet hardware you are using? Send M115 from the console and post the response. For DWC, look on the Settings > General tab.
I would expect that the Gcode would be interpreted correctly by the firmware, and this is a viewer bug. @Sindarius is on it!
Ian
-
M115 FIRMWARE_NAME: RepRapFirmware for Duet 2 WiFi/Ethernet FIRMWARE_VERSION: 3.4.6 ELECTRONICS: Duet WiFi 1.02 or later FIRMWARE_DATE: 2023-07-21 14:08:28 Duet Web Control 3.4.6
-
@Sindarius said in G-code Viewer G2/G3 arc preview:
@MikeS I'll need to take a deeper look into what is going on with the viewer but it is upset with the U and V params. If you remove them the rendered matches NCViewer.
I can confirm that code without U and V axis is previewing fine. I attach a more elaborated g-code with more arcs that works well with only X and Y but causes a lot of problems for the preview if U and V are present. I hope this can help you troubleshoot the problem and test a future fix. Unfortunately arcs are not so common on current slicers.
X and Y only
Sofia 2Axis.g
X,Y,U and V
Sofia 4Axis.g
-
@MikeS the problem is that the current code in the viewer for arcs is not properly tokenizing out the U and V axes so it is ending up with a bad value. I’ll get a fix in place to make sure the extra axes get tokenized properly.
-
@Sindarius any news on that? In the meantime i moved my script to inkscape that has advanced scripting functionality and i can convert all the curves to lines so I don't have issues.