1

I have a file "myFile.gcode" which contains some G-code commands. As it stands Universal Gcode Sender allows the user to upload a file to be executed. However I would like "myFile.gcode" to be run as soon as the program starts up instead of me having to upload it.

Is this possible with the out-of-the-box .jar file?

.jar available at https://winder.github.io/ugs_website/

If not I have the following idea,

  • Trace through the code and reverse engineer it to auto run the file. To do this I decompiled the .jar file, but when tracing through the code I'm having trouble finding the starting point (main class) of the code.

In summary, is this possible?

And, what could make tracing this code easier?

Giga Chad Coding
  • 178
  • 3
  • 12

1 Answers1

1

Yes there is a new feature for running CLI-commands, download the latest nightly build of Universal G-code Sender Classic and run the follwing:

# java -cp UniversalGcodeSender.jar com.willwinder.ugs.cli.TerminalClient --help

This will print the available parameters and options:

 -b,--baud <baudrate>           Baud rate to connect with.
 -c,--controller <controller>   What type of controller firmware we are
                                connecting to, defaults to "GRBL". These
                                are the available firmwares: [GRBL, TinyG,
                                Testing (Delay), Smoothie Board, Testing]
 -d,--daemon                    Starts in daemon mode providing a web
                                pendant UI
 -dr,--driver <driver>          Sets and saves the connection driver
                                setting. These are the available drivers:
                                [JSERIALCOMM, JSSC, TCP]
 -f,--file <filename>           Opens a file for streaming to controller
                                and will exit upon completion.
 -h,--help                      Prints the help information.
 -ho,--home                     If a homing process should be done before
                                any gcode files are sent to the
                                controller.
 -l,--list                      Lists all available ports.
 -p,--port <port>               Which port for the controller to connect
                                to. I.e /dev/ttyUSB0 (on Unix-like systems
                                or COM4 (on windows).
 -pp,--print-progressbar        Prints the progress of the file stream
 -ps,--print-stream             Prints the streamed lines to console
 -r,--reset-alarm               Resets any alarm
 -v,--version                   Prints the software version.
 -w,--workspace <dir>           Sets and saves the workspace directory
                                setting

Sending a file can be done using the following command:

# java -cp UniversalGcodeSender.jar com.willwinder.ugs.cli.TerminalClient --controller GRBL --port /dev/ttyUSB0 --baud 115200 --print-progressbar --file test.gcode

Connected to "Grbl 0.9z" on  baud 115200
Running file "test.gcode"
test.gcode  52% │██████████████████████▉                    │  55/105 (0:00:06 / 0:00:05) 
  • The problem is, opening the file does not set the proper settings, nor open the connection to the board. It's honestly pretty stupid that a program like this would not contain much more adept terminal commands.... – Giga Chad Coding Jun 17 '18 at 15:57
  • Then I suggest that you head over to the github project and create an issue with a feature request, or contribute with source code for this. – Joacim Breiler Jun 18 '18 at 18:02
  • 1
    Updated my answer now that UGS can be run in CLI-mode – Joacim Breiler Apr 14 '19 at 13:54