svenhb / GRBL-Plotter

A GCode sender (not only for lasers or plotters) for up to two GRBL controller. SVG, DXF, HPGL import. 6 axis DRO.
https://grbl-plotter.de/
GNU General Public License v3.0
696 stars 176 forks source link

Clean GCode export #238

Closed wiring80 closed 2 years ago

wiring80 commented 3 years ago

I use GRBL-Plotter with an MKS-DLC with an TFT24 for offline plotting.

So i create the GCode and export it to SD Card, but must clean the GCode file from all bracket "(" and ")" with its included content, with Notepad++ or equal program.

Its not really important, but would be nice if a export setting will be added, for clean GCode generation, cause the TFT24 stop streaming the GCode, if found rows with brackets etc.. No matter if the bracket found at start at the row, or after GCode. Furthermore it would be nice to implement in which encoding the GCode file will be saved, i prefer ANSI or the almost equal ISO8859-1, seem to do the best on the TFT24, with UTF there were sporadic stops at streaming.

Anyway, the MKS TFT24 is buggy in many ways :-/

svenhb commented 3 years ago

Yes I can implement this feature.

svenhb commented 3 years ago

Hm, I don't have so much choices for encoding: System.Text.ASCIIEncoding System.Text.UnicodeEncoding System.Text.UTF32Encoding System.Text.UTF7Encoding System.Text.UTF8Encoding

wiring80 commented 3 years ago

Mhmm, I don't have my PC ready at the moment, cause my screen is defective and on the way to the seller for warranty, so I can't test it. I use visual studio for my private developements too.

With c# that could be a way for converting Utf8 to ISO without - more to say filtered signs that are not available in ISO:

Encoding iso = Encoding.GetEncoding("ISO-8859-1"); Encoding utf8 = Encoding.UTF8; byte[] utf_Bytes = utf8.GetBytes(text); byte[] iso_Bytes = Encoding.Convert(utf8,iso,utf_Bytes); string output = iso.GetString(iso_Bytes);

Without warranty :-)

Greets from Germany, Sven K.

svenhb commented 3 years ago

This works: Encoding.GetEncoding("ISO-8859-1"); Gruß aus Bremen ;-)

wiring80 commented 3 years ago

Perfect :-)

Ah, denn Mal Grüße zurück aus Nähe Hagen NRW :-)

svenhb commented 3 years ago

Try new version: https://github.com/svenhb/GRBL-Plotter/releases

wiring80 commented 2 years ago

Thanks a lot. Seems to work, however - Notepad++ shows the file as Utf8, but choosed Iso 8859-1 in GRBL Plotter. Curios thing - my Linux GEdit tells me the correct encoding, iso 8859-1. So, think GRBL Plotter does it right :-)