Tuesday, October 30, 2012

How to write a Cura / Skeinforge plugin

First, do you really really want to write a Skeinforge plugin ?


Preliminary notes: some sites such as wired link to this post, but you may like to read my less technical review about temperature gradients applied to wood first. Also, you could check this post if you just want to try it.

Now, read on if you are a programmer and want to write your own plugin for Skeinforge. Note also that Cura no more uses Skeinforge as it has a much easier plugin system (that cannot do as much as what can be done with Skeinforge though).

Indeed and contrary to what was being done so far, I did not want to manually insert the M104 temperatures changes in the file sent to the printer, nor stay close to the ulticontroller. So I designed a plugin for the Cura / Skeinforge software pair.

Since that was not trivial, I document the procedure here.



Printing cushwa's owl (youtube hosts the HD version)

Cura probably will soon support its own plugin system, which will be easier compared to the Skeinforge labyrinth. Dealing with the latter is both complex and not enjoyable even though it does the job, and Cura "old style" adss a convenient GUI on top of it (see first pic).

Writing a Skeinforge plugin in the first place also makes it usable by users of the standalone Skeinforge obviously! Reciprocally, a Cura-specific plugin would make it compatible with the different slicers what it will support soon or later. And I hope it will be sooner than later!

Also, everything there is written in Python. Which is good since it is a clear an easy language (this was my first real experience with it by the way), even though it is slower than many other languages.

Where to create the plugin

Obviously, start by downloading Cura sourcecode. This post was made for version 12.08.

You are looking for the "craft" directory here:

skeinforge_application/skeinforge_plugins/craft_plugins

The best way to proceed is to duplicate an existing python plugin. Select one which is close to the functionality you are to implement, it will help also locating the reference to your plugin elsewhere (well, this post is there to help further in fact).

What to modify in existing sources

Add a section for your plugin with labels and help in:

Cura/cura_sf/fabmetheus_utilities/settings.py

Make sure to keep consistent naming as the labels are used by the program to transfert data between Cura interface, Skeinforge and the plugin (this is completely ugly by the way).

Add your plugin name to the list of extrusion operations in getCraftSequence(), keeping it in a correct sequence here:

Cura/cura_sf/skeinforge_application/skeinforge_plugins/profile_plugins/extrusion.py

Add the interface to Cura, most probably in the expert panel, taking extreme care with the namings again:

Cura/gui/expertConfig.py

One more setting block (with default values) in

Cura/util/profile.py

Finally, add it here if it takes time to process, with the appropriate factor:

Cura/util/sliceRun.py

Final note

Once again make sure you are consistent with the labels and plugin parameter names, else you will run in trouble passing the values from Cura GUI to your plugin. Seriously, consider postponing your plugins until there is something better for Cura. Meanwhile, you may read and use Daid's related message.

No comments:

Post a Comment