I've been doing that via PythonSCAD for my current project https://github.com/WillAdams/gcodepreview and it might be interesting to do a re-write in another language.
I’d pick Lua over Python any day, but maybe that’s just me. ;-)
Lua is easier to use, faster, and more feature-rich. It's one of those rare occasions when a new solution is actually better in every single way.