Skip to content
xmarduel edited this page Jan 5, 2022 · 38 revisions

PyCut

Warning: PyCut is still in early stage and rapid development, the software is completely beta (but usable).

PyCut is a clone of jsCut, the excellent (at least for beginners) CAM, web-based programm, that takes as input svg files and generates G-Code. So why this rewrite ?

One reason is: I wanted the spindle control (M3/M5) codes inside the generated g-code. It is worth a rewrite!

So it begins as a "fun" project, in order to understand how a G-code generator works, and how easy (or hard) it is to achieve. Well, it is not so easy (but stealing jsCut code helps). And I learned about jsCut through the CnC Philosophy pages.

By the way,I began to use jsCut because Easel (for beginners too), although free, makes limitations (among others) on the choices of the fonts - which is quite a shame...

So PyCut is written in python, with the GUI with PySide6. I actually use Python-3.9. The Python version can be of importance for the Clipper SWIG wrapper on MS windows. It seems different versions of python load DLLs differently. In all cases, for Python-3.9 it seems that some mingw64 libs are required alongside the generated .pyd wrapper (setting the PATH did not help). These few libs have been pushed in the repository. I did not try wrappers for linux/macos.

Hopefully there will be users that will be able to contribute. There is a developper doc for this purpose (TODO)

The excellent things from jsCut are (among others):

  • a great svg viewer, with an API to add svg path(s) to the viewer content:
    • in black the regions of the geometry that will be affected
    • in green the calculated toolpaths
  • a great gcode simulator -in webgl-
  • the CAM stuff, based on the Clipper library (simple enough for me)

So the idea is the following:

  • MainWindow in PySide DONE
  • in PySide, display the SVG viewer stuff (QGraphicsView with SvgItem) DONE (tabs, geometry previews, toolpaths)
  • in PySide, display the WebGL stuff (QEngineView) DONE
  • Tool paths generation (lot of js code to understand) DONE
  • Tabs handling DONE (handled differently than is jsCut)
  • G-Code generation with spindle control (actually absent in jsCut -wow! what a feature!-) DONE
  • G-Code viewer (as in Candle) DONE

After that

  • Migrating WebGL stuff to "native" python ? (QtOpenGL) TODO
  • or using opencamlib (they say its ok but the GUI has to be done by the client app) TODO

Then

It should not be necessary to pass to PyCut svg with only "paths" svg elements. All svg elements

  • <rect>
  • <circle>
  • <ellipse>
  • <polygon>
  • <line>
  • <polylines>

should be loadable (as well as <path> of course). The <text> elements have to be exported as path as well.

Inkscake export to paths could be used internally (transparently to the user), so the "problem" would be resolved.

By the way, such an export keeps the possible elements transformations, and PyCut needs paths without transformations.

This problem is anyway already present in PyCut. The Inkscape user has to resolve the existing transformations. A way to do this is to group/ungroup the items with transformations inside the Inkscape GUI.

Clone this wiki locally