DEV Community

mycodes21
mycodes21

Posted on

Mechanical Engineering + Python: A Great Combination for Simple Tasks (Showcasing PyNCViewer)


Hello everyone! πŸ‘‹

I am a Mechanical Engineer based in Serbia, passionate about bridging the gap between hardware (CNC machines) and software.

Often, engineers are stuck using heavy, expensive, and bloated industrial software just to check a simple G-code file or visualize a toolpath. I wanted something faster, lighter, and modern. So, I decided to build it myself using Python.

I present to you PyNCViewer.

What is PyNCViewer?
It is a modern, open-source G-Code Viewer and Simulator for CNC machines. I designed it for engineers, machinists, and hobbyists who need a fast tool to visualize, analyze, and edit G-Code without waiting for a heavy CAD/CAM suite to load.

Key Features πŸ› οΈ
Here is what it can do right now:

Real-time Visualization: Full 3D OpenGL rendering with Pan/Zoom/Rotate capabilities.

Animation Mode: You can "play" the machining process with an adjustable speed slider to see exactly how the tool moves.

Smart Scan: It automatically detects potential crashes (Rapid G0 into material), missing feed rates, and syntax errors.

Tool Library: Support for multiple tools (T1, T2...) with custom diameters.

DXF Export: A unique feature that allows you to reverse engineer G-Code back into DXF drawings.

Advanced Editor: Includes syntax highlighting, renumbering lines, and removing line numbers.

Transformations: Mirror, Scale, Shift, and Axis Swap your G-code instantly.

DRO Panel: Digital Readout of coordinates during simulation.

The Tech Stack πŸ’»
For those interested in the code, I built this using:

Python 3

CustomTkinter (for the modern dark-mode UI)

NumPy (for coordinate calculations)

OpenGL (for rendering)

Why Open Source?
I believe engineering tools should be accessible. Whether you are a student, a hobbyist with a 3D printer, or a professional machinist, you shouldn't have to pay a subscription just to view a G-code file.

Try it out! πŸš€
The project is fully open-source on GitHub. I would love to hear your feedback, bug reports, or feature requests!

https://github.com/mycodes21/PyNC_Viewer

(Feel free to Star the repo if you find it useful! ⭐)

Top comments (0)