Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
7883a7e5
Commit
7883a7e5
authored
May 30, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Follow tool changes in GCoder and GCView
parent
5ffc3ac5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
21 deletions
+15
-21
gcoder.py
printrun/gcoder.py
+7
-1
actors.py
printrun/libtatlin/actors.py
+8
-20
No files found.
printrun/gcoder.py
View file @
7883a7e5
...
...
@@ -31,7 +31,7 @@ class Line(object):
'raw'
,
'split_raw'
,
'command'
,
'is_move'
,
'relative'
,
'relative_e'
,
'current_x'
,
'current_y'
,
'current_z'
,
'extruding'
,
'current_x'
,
'current_y'
,
'current_z'
,
'extruding'
,
'current_tool'
,
'gcview_end_vertex'
)
def
__init__
(
self
,
l
):
...
...
@@ -131,6 +131,7 @@ class GCode(object):
imperial
=
False
relative
=
False
relative_e
=
False
current_tool
=
0
filament_length
=
None
xmin
=
None
...
...
@@ -178,10 +179,12 @@ class GCode(object):
imperial
=
self
.
imperial
relative
=
self
.
relative
relative_e
=
self
.
relative_e
current_tool
=
self
.
current_tool
for
line
in
lines
:
if
line
.
is_move
:
line
.
relative
=
relative
line
.
relative_e
=
relative_e
line
.
current_tool
=
current_tool
elif
line
.
command
==
"G20"
:
imperial
=
True
elif
line
.
command
==
"G21"
:
...
...
@@ -196,11 +199,14 @@ class GCode(object):
relative_e
=
False
elif
line
.
command
==
"M83"
:
relative_e
=
True
elif
line
.
command
[
0
]
==
"T"
:
current_tool
=
int
(
line
.
command
[
1
:])
if
line
.
command
[
0
]
==
"G"
:
line
.
parse_coordinates
(
imperial
)
self
.
imperial
=
imperial
self
.
relative
=
relative
self
.
relative_e
=
relative_e
self
.
current_tool
=
current_tool
def
_preprocess_extrusion
(
self
,
lines
=
None
,
cur_e
=
0
):
if
not
lines
:
...
...
printrun/libtatlin/actors.py
View file @
7883a7e5
...
...
@@ -237,6 +237,9 @@ class GcodeModel(Model):
Model for displaying Gcode data.
"""
color_travel
=
(
0.6
,
0.6
,
0.6
,
0.6
)
color_tool0
=
(
1.0
,
0.0
,
0.0
,
0.6
)
color_tool1
=
(
0.0
,
0.0
,
1.0
,
0.6
)
color_printed
=
(
0.2
,
0.75
,
0
,
0.6
)
use_vbos
=
True
...
...
@@ -297,28 +300,13 @@ class GcodeModel(Model):
"""
Return the color to use for particular type of movement.
"""
# default movement color is gray
color
=
[
0.6
,
0.6
,
0.6
,
0.6
]
"""
extruder_on = (move.flags & Movement.FLAG_EXTRUDER_ON or
move.delta_e > 0)
outer_perimeter = (move.flags & Movement.FLAG_PERIMETER and
move.flags & Movement.FLAG_PERIMETER_OUTER)
if extruder_on and outer_perimeter:
color = [0.0, 0.875, 0.875, 0.6] # cyan
elif extruder_on and move.flags & Movement.FLAG_PERIMETER:
color = [0.0, 1.0, 0.0, 0.6] # green
elif extruder_on and move.flags & Movement.FLAG_LOOP:
color = [1.0, 0.875, 0.0, 0.6] # yellow
elif extruder_on:
color = [1.0, 0.0, 0.0, 0.6] # red
"""
if
move
.
extruding
:
color
=
[
1.0
,
0.0
,
0.0
,
0.6
]
# red
if
move
.
current_tool
==
0
:
return
self
.
color_tool0
else
:
return
self
.
color_tool1
return
color
return
self
.
color_travel
# ------------------------------------------------------------------------
# DRAWING
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment