Creating a G-Code VMC Runtime Calculator with Python
A few months ago, I set out to create a simple tool in Python that would allow the user to paste G-code for a Vertical Machining Center (VMC) and provide the user with line-by-line insight of the runtime of the machine at various stages of the program. It took some time to achieve this, but using some OOP and Python's pandas library, I was able to achieve my goal.
The calculator I created allows the user to paste the G-code in a provided .txt file, called snippet.txt. The guidelines of the program require that:
Recommended by LinkedIn
Once the user completes the prompts given by the program, the appropriate data from snippet.txt is extracted, calculations are made based on the user's input, and the resulting data is nicely organized into a .csv file which the user can access using a spreadsheet application such as Microsoft Excel or Google Sheets. The resulting workbook provides the user with information on the runtime of the machine as the machine progresses through the G-code line-by-line.
As many CNC machines in manufacturing today are either older, simply lack this feature of runtime tracking, or the data on machining runtime was lost for some reason, this calculator provides the user with approximations for runtimes using 3-dimensional Euclidean norms, and constant velocity formulas.
A repository for this program has been posted to GitHub. Access it here: https://github.com/chasereiter43/G-Code-VMC-Runtime-Calculator-via-Excel