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
4d7fbea0
Commit
4d7fbea0
authored
May 29, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor changes to gcoder to correctly process gcode added over time
parent
5ddea3cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
gcoder.py
printrun/gcoder.py
+10
-6
No files found.
printrun/gcoder.py
View file @
4d7fbea0
...
...
@@ -148,7 +148,7 @@ class GCode(object):
(
l
.
strip
()
for
l
in
data
)
if
l2
]
self
.
_preprocess_lines
()
self
.
_preprocess_extrusion
()
self
.
filament_length
=
self
.
_preprocess_extrusion
()
self
.
_create_layers
()
self
.
_preprocess_layers
()
...
...
@@ -162,9 +162,11 @@ class GCode(object):
gline
=
Line
(
command
)
self
.
lines
.
append
(
gline
)
self
.
_preprocess_lines
([
gline
])
self
.
_preprocess_extrusion
([
gline
])
self
.
append_layer
.
lines
.
append
(
gline
)
self
.
layer_idxs
.
append
(
self
.
append_layer_id
)
self
.
line_idxs
.
append
(
len
(
self
.
append_layer
.
lines
))
return
gline
def
_preprocess_lines
(
self
,
lines
=
None
):
"""Checks for G20, G21, G90 and G91, sets imperial and relative flags"""
...
...
@@ -173,7 +175,7 @@ class GCode(object):
imperial
=
self
.
imperial
relative
=
self
.
relative
relative_e
=
self
.
relative_e
for
line
in
self
.
lines
:
for
line
in
lines
:
if
line
.
is_move
:
line
.
relative
=
relative
line
.
relative_e
=
relative_e
...
...
@@ -197,12 +199,14 @@ class GCode(object):
self
.
relative
=
relative
self
.
relative_e
=
relative_e
def
_preprocess_extrusion
(
self
):
def
_preprocess_extrusion
(
self
,
lines
=
None
,
cur_e
=
0
):
if
not
lines
:
lines
=
self
.
lines
total_e
=
0
max_e
=
0
cur_e
=
0
for
line
in
self
.
lines
:
for
line
in
lines
:
if
line
.
e
==
None
:
continue
if
line
.
is_move
:
...
...
@@ -217,7 +221,7 @@ class GCode(object):
elif
line
.
command
==
"G92"
:
cur_e
=
line
.
e
self
.
filament_length
=
max_e
return
max_e
# FIXME : looks like this needs to be tested with list Z on move
def
_create_layers
(
self
):
...
...
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