Commit b693afe9 authored by D1plo1d's avatar D1plo1d

Merge branch 'experimental' of github.com:kliment/Printrun into experimental

parents c8921578 716651b2
...@@ -250,6 +250,12 @@ To use pronterface, you need: ...@@ -250,6 +250,12 @@ To use pronterface, you need:
Please see specific instructions for Windows and Mac OS X below. Under Linux, you should use your package manager directly (see the "GETTING PRINTRUN" section) Please see specific instructions for Windows and Mac OS X below. Under Linux, you should use your package manager directly (see the "GETTING PRINTRUN" section)
## Cython-based G-Code parser
Printrun default G-Code parser is quite memory hungry, but we also provide a much lighter one which just needs an extra build-time dependency (Cython), plus compiling the extension with:
python setup.py build_ext --inplace
## Windows ## Windows
Download the following, and install in this order: Download the following, and install in this order:
......
...@@ -241,7 +241,8 @@ class GcodeModel(Model): ...@@ -241,7 +241,8 @@ class GcodeModel(Model):
color_tool0 = (1.0, 0.0, 0.0, 0.6) color_tool0 = (1.0, 0.0, 0.0, 0.6)
color_tool1 = (0.0, 0.0, 1.0, 0.6) color_tool1 = (0.0, 0.0, 1.0, 0.6)
color_printed = (0.2, 0.75, 0, 0.6) color_printed = (0.2, 0.75, 0, 0.6)
color_current = (0.6, 0.3, 0, 1) color_current = (0.6, 0.3, 0, 0.8)
color_current_printed = (0.1, 0.4, 0, 0.8)
use_vbos = True use_vbos = True
loaded = False loaded = False
...@@ -361,9 +362,9 @@ class GcodeModel(Model): ...@@ -361,9 +362,9 @@ class GcodeModel(Model):
# Draw printed stuff until end or end_prev_layer # Draw printed stuff until end or end_prev_layer
cur_end = min(self.printed_until, end) cur_end = min(self.printed_until, end)
if end_prev_layer >= 0: if 0 <= end_prev_layer <= cur_end:
cur_end = min(cur_end, end_prev_layer) glDrawArrays(GL_LINES, start, end_prev_layer)
if cur_end >= 0: elif cur_end >= 0:
glDrawArrays(GL_LINES, start, cur_end) glDrawArrays(GL_LINES, start, cur_end)
glEnableClientState(GL_COLOR_ARRAY) glEnableClientState(GL_COLOR_ARRAY)
...@@ -374,19 +375,29 @@ class GcodeModel(Model): ...@@ -374,19 +375,29 @@ class GcodeModel(Model):
glDrawArrays(GL_LINES, start, end_prev_layer - start) glDrawArrays(GL_LINES, start, end_prev_layer - start)
cur_end = end_prev_layer cur_end = end_prev_layer
glDisableClientState(GL_COLOR_ARRAY) # Draw current layer
if end_prev_layer >= 0:
glDisableClientState(GL_COLOR_ARRAY)
# Backup & increase line width
orig_linewidth = (GLfloat)()
glGetFloatv(GL_LINE_WIDTH, orig_linewidth)
glLineWidth(2.0)
glColor4f(*self.color_current_printed)
if cur_end > end_prev_layer:
glDrawArrays(GL_LINES, end_prev_layer, cur_end - end_prev_layer)
glColor4f(*self.color_current) glColor4f(*self.color_current)
# Draw current layer if end > cur_end:
orig_linewidth = (GLfloat)() glDrawArrays(GL_LINES, cur_end, end - cur_end)
glGetFloatv(GL_LINE_WIDTH, orig_linewidth)
glLineWidth(2.0)
if end_prev_layer >= 0 and end > end_prev_layer:
glDrawArrays(GL_LINES, end_prev_layer, end - end_prev_layer)
glLineWidth(orig_linewidth)
glEnableClientState(GL_COLOR_ARRAY) # Restore line width
glLineWidth(orig_linewidth)
glEnableClientState(GL_COLOR_ARRAY)
# Draw non printed stuff until end (if not ending at a given layer) # Draw non printed stuff until end (if not ending at a given layer)
start = max(self.printed_until, 0) start = max(self.printed_until, 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment