Python script to generate wood patterns (temperature changes)

306
Downloads
2403
Views
Published on February 11, 2013

Description

Script to generate texture via temperature gradients to get horizontal stripes that "look like wood".

The owl is Cushwa's popular design at thingiverse.com/thing:18218

It was printed here with LAYWOO-D3 wood filament thingiverse.com/thing:30552
It works also somehow with some other filament (just tweak the temperature), with a less drastic effect.

This is a piece of source code of mine, originally made for Skeinforge within Cura 12.08, now part of the official releases, and is now also an independent standalone Python script.

Instructions

This is the code of my post here: betterprinter.blogspot.fr/2012/10/shades-of-brown-with-wood-filament-via.html


Last updates:
Tue Feb 12 08:35:53 UTC 2013
- more readable ASCII art plot
- can be re-run on itself, it will no more duplicate the commands and graph
- fixed a bug in the numeric arguments (thanks to Fused3D)


This script was an official plugin in Cura (version 12.11+). Check it here: wiki.ultimaker.com/CuraPlugin:_Wood Thanks to Daid for porting my old Skeinforge/Cura version to the new and much cleaner plugin system. The tgz archive could be useful only to Skeinforge users or old-timers of Cura. Better ignore it ;)

After multiple requests and at last, I finally converted it to a standalone Python script that no more needs Cura nor Skeinforge. I documented the process here by the way: betterprinter.blogspot.fr/2013/02/how-tun-run-python-cura-plugin-without.html

You'll need Python on your computer. Then run the wood_standalone.py script as follows:

python wood_standalone.py --min minTemp --max maxTemp --grain grainSize --file gcodeFile

or in brief mode:

python wood_standalone.py -i minTemp -a maxTemp -g grainSize -f gcodeFile

This will "patch" your gcode file in place (it will be modified), so keep a backup if you need one.
- minTemp is the minimum temperature to use (the code ensures that it is reached)
- maxTemp is the maximum temperature to use (the code ensures that it is reached)
- grainSize lets you tweak the "average thickness" of the layers
The gcodeFile is the only compulsory parameter.

Initial temperature settings will be overridden by the varying pattern that is generated by this script (a variant of recursive Perlin noise). You can run it multiple times to test different values and generated temperature curve until you like it.

Default values are minTemp=190, maxTemp=240 and grainSize=3. Higher themperature give darker bands (due to the wood being burnt). Do not let the wood stay too long in your nozzle else you will most probably clog it with carbon!

Finally, to run it on windows you may want to check the FAQ here: docs.python.org/2/faq/windows.html
Report as inappropriate

You must be logged in to post a comment.

Wow! Will try it myself and link to your post on website! Thanks a lot!

This is top - thank you. Currently printing an Owl in Laywood scaled to 70% of the original size. This is the second Laywood print I have done - for the first, I had to sit next to the printer for a couple of hours tweaking away at the hot end temperature so this standalone script has enabled me to let it get on with things.

Glad you like it. One thing that makes it better also is the kind of variations applied to the temperature (these are not pure random).
I also fixed something absent from Cura 12.10+: every temperature found in the file was overridden by the plugin, including the last one. So at the end of the print, the nozzle was left hot, which is bad.
This version tries to keep the last temperature (usually something like M104 S0 = cool down).

Make sure to take pictures and post. Any ideas what you'll be printing next?

Oops! Sorry for this, I fixed it on Tue Feb 12 08:35:53 UTC 2013
You can contact me at jeremie francois at gmail

It would be cool if you could have the script show the graph before editing, then if you like it have it edit the file, and if you don't then redo the temperature gradients until you do like it

Good idea. I implemented this in the last version. I also transposed the graph so it easily be viewed in a text editor: now, simply run again the script to update the file. The previous generated temperatures will be overridden, no need to start again with the original file, much easier to tweak then.

So if I don't like the wood temperature graph at the beginning of the gcode, I just run it again on the original gcode file I take it?

Now you just need to re-run the same command line (up arrow + enter in the console), the old temperatures will be discarded and a new plot is generated. Check it in a text editor, it's easier to view now :)

Printed out a Bear with the Wood Filament: http://www.thingiverse.com/thi...
Didn't have the python script to run on the gcode before I printed it.

Hm sure, but would you send some to me for this free advertising space? ;)

If you can get a skeinforge plugin made, or standalone plugin made to modify gcode for varying the colors of wood in a print I would happily send you a roll of it.

Wow, awesome work man. Really, really awesome.

That was originally motivated by my laziness, as I quit did not want to insert M104 commands manually throughout an entire g-code file ;)
I'm glad you like it, but the material itself is the awesome stuff: except for chocolate or clay it is the first one that really looks and feel gorgeous and not like cheap plastic. Still a bit expensive and with its own set of "properties" but one major improvement imho.

SUch a cool idea!

What would it take to run it as a Skeinforge module rather than a Cura module? That way it would be usable by more people. :-)

Yes please, Skeinforge!!