Loading

Blender 2.5 gcode reader

by zignig, published

Blender 2.5 gcode reader by zignig Feb 4, 2011

Description

This has been superseded by thingiverse.com/thing:6236

This is a python3 script for blender 2.5 that reads gcode files and creates polylines for tool head moves. It also animates with 1 frame per layer.

Put the script up on github for development

github.com/zignig/blender-gcode-reader

Recent Comments

view all

I have an idea I would like to try, but it it requires me to know the predicted geometry of material laid down at a number of intervals mid print. Would this plugin be able to give me such information? If so, would it be possible to convert that geometry into a boolean mask in cartesian coordinates that simply indicates wheteher plastic exists at a given set of coordinates?

I made an animation of the brehead extrusion in blender

Try (might not work)
https://github.com/daveland/bl...

or download the file. brehead.avi
https://github.com/daveland/bl...

and, if you have perl

run this script and
&
gt; it to a file.

#!/usr/bin/perl

open FILE, $ARGV[0] or die $!;

while (
&
lt;file
&
gt;) {

s/\(.*//g;

s/;//g;

s/G162.*//g;

s/G161.*//g;

if (!m/^\s+$/) {

print $_;

}

}

Liked By

view all

License

GNU - LGPL
Blender 2.5 gcode reader by zignig is licensed under the GNU - LGPL license.

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag. Print Thing Tag

Instructions

1. open text file in blender2.5
2. edit the file path
3. run script ( alt P )
4. visualize gcode

Comments

You must be logged in to post a comment.

brucedjones on Feb 19, 2011 said:

I have an idea I would like to try, but it it requires me to know the predicted geometry of material laid down at a number of intervals mid print. Would this plugin be able to give me such information? If so, would it be possible to convert that geometry into a boolean mask in cartesian coordinates that simply indicates wheteher plastic exists at a given set of coordinates?

davelandia on Feb 13, 2011 said:

I made an animation of the brehead extrusion in blender

Try (might not work)
https://github.com/daveland/bl...

or download the file. brehead.avi
https://github.com/daveland/bl...

ahmetcemturan on Feb 9, 2011 said:

This is awesome. Unfortunately it does not when it has the M codes (101 103 108) removed.

Is it possible that you can make it work without them? Then a stepper extrurder user would be able to use it too. (I have a mendel-parts reprap....)

Still: its awesome.... Thank you for the effort.

ahmetcemturan on Feb 9, 2011 said:

I am doing it at the moment the way that I put a M101 command in the beginning and an M103 command to the end of the gcode file...

spirail on Feb 9, 2011 said:

Awesome!

I just got my machine and have been printing my own models for a week.
The only thing that i felt was missing was "a python script for showing all the layers in blender" and it was really a case of doing it myself, or being paitent enough for someone else do to it..
8 hours later, and its right t
here.

This is the best forum ever.

Tomorrow, I'm going to wish for someone who can take the model produced here and convert it back into gcode. Then we can can start making slight modifications and start picking where the "stringers" will form when the extruder hops over the gaps.

DaveD on Feb 8, 2011 said:

It'd be extra cool if this (or v2 or v3 of this) read
&
amp; parsed comments. In particular, the numbers following "(
&
lt;layerthickness
&
gt;" and "(
&
lt;perimeterwidth
&
gt;" would be good to parse, if present.

You could also figure out thread height from the gcode - good for files that don't have comments or don't come from skeinforge - but the widths are tricky. Skeinforge may write the perimeter width to the file as a comment but it doesn't appear to include the infill width or things like differences
in the shape of bridge layers due to the feed/flow modifiers..

jhdgkss on Feb 8, 2011 said:

Hi sorry too ask but i know nothing about blender ( i use 3DS Max) and how it works could you please post an idiot guide to running this script.

Thanks

Bye the way this is awsome.....

yzorg on Feb 7, 2011 said:

you r genious!

now do it for cinema4D XD

neoteric on Feb 7, 2011 said:

ok, how do I remove comments from the gcode so it will work? It appears to work fine for the gcode provided, but doesnt seem to work for commented gcode. THANKS FOR THIS!!!

spirail on Feb 9, 2011 said:

im on linux, so i lazily did it in vi with regex

0. get a text editor that does regex

1. (vi only) use 'dd' to drop the first lines that look like comments

2.
:%s/(.*//g
this will drop all other comments from the file

3.
:%s/;//g
this drops all the semi-columns

4.
:g/^$/ d
this drops all the blank lines

5. last there are two lines that look like this:
G162 Z F500 (home Z axis
maximum)
G161 X Y F2500 (home XY axes minimum)
you can drop them too.

no doubt the code will be updated very soon to fix all this.

As others have said, run blender from console for clues. When it works, blender freeses for a few mins while it processes. If it failed, you get window control back i
nstantly.

neoteric on Feb 8, 2011 said:

Ok, the answer is to turn off comments in the export module in skeinforge. You may also have to manually delete you start.txt and the beginning of the file? For me, if I could get rid of that, then it seems to work.

mifga on Feb 7, 2011 said:

I'm very excited -- and Robot Hospital! wants to feature a quick demo of this in the next couple of weeks. Email me at griffin at makerbot dot com so we can chat!

Wade on Feb 7, 2011 said:

Wow - this is really great!

davelandia on Feb 7, 2011 said:

Zignig

I messed with this a bit and it is awesome!! I posted a render of my favorite object.

I got the comments removed so gcode from skeinforge goes right in. Can I send it to you? Then you can update it here!!

davelandia on Feb 7, 2011 said:

Or i can set it up on my github account if you don't mind.

MaskedRetriever on Feb 6, 2011 said:

Tested on my 2.5 machine, works great! Wonderful!

Blender 2.5's new interface has some tricks for creating toolshelf widgets that do things like select constants and (presumably) file selection boxes. If I get a chance I'll give building that part a try because this would be a fabulous add-on then.

Heck, it's already going to make my life a lot
easier.

Anonymous on Feb 6, 2011 said:

You sir are a certifiable genius.

LeoM on Feb 5, 2011 said:

As Blender user I love this !
&
lt;3

MaskedRetriever : +1 !

MaskedRetriever on Feb 5, 2011 said:

This is very exciting! A really beautiful alternative to Skeinview, etc on machines not compatible with Pleasant3D. Also, it's wonderful that scripting in Blender is getting applied to 3D printing, because ultimately Blender should totally have "3D printer drivers" that hook directly to the printer and print from Blender.

Because that will be badass.

zignig on Feb 5, 2011 said:

Sublime,

If you run blender from a terminal , you should get some info.
At the moment it does not deal with (bracketed) comments in file.

I does not require any other packages , I am running on Blender 2.56a on Ubuntu 10.04.

I should put the script up on github , so it can be shared better :)

SayNoToMakerbot on Feb 5, 2011 said:

Ok well this is the output

opening /home/b/test.gcode
19669 lines
no code ;
building curves
has 0 layers
createing poly lines
profile exisits
animating build
frame 0
finishing parsing

I've tried it with code generated by replicatorG and repsnapper. I've also tried an assortment of items from a simple cube to complex items.

What window should the output be in 3Dview or UVImage editor or ?

SayNoToMakerbot on Feb 5, 2011 said:

Just thought I would add that my blender is 2.56 r34630 on Ubuntu 10.10

schmarty on Feb 5, 2011 said:

This has the possibility of being very, very pretty.

Top