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
659cc031
Commit
659cc031
authored
Jan 24, 2013
by
kliment
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #324 from Lenbok/experimental-gcoder-relative-e
Support M82/M83 for relative E
parents
c527601f
e2630df4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
gcoder.py
gcoder.py
+11
-1
No files found.
gcoder.py
View file @
659cc031
...
@@ -40,6 +40,7 @@ class Line(object):
...
@@ -40,6 +40,7 @@ class Line(object):
self
.
raw
=
l
.
upper
()
.
lstrip
()
self
.
raw
=
l
.
upper
()
.
lstrip
()
self
.
imperial
=
False
self
.
imperial
=
False
self
.
relative
=
False
self
.
relative
=
False
self
.
relative_e
=
False
if
";"
in
self
.
raw
:
if
";"
in
self
.
raw
:
self
.
raw
=
self
.
raw
.
split
(
";"
)[
0
]
self
.
raw
=
self
.
raw
.
split
(
";"
)[
0
]
...
@@ -145,6 +146,7 @@ class Layer(object):
...
@@ -145,6 +146,7 @@ class Layer(object):
ymax
=
-
999999999
ymax
=
-
999999999
zmax
=
-
999999999
zmax
=
-
999999999
relative
=
False
relative
=
False
relative_e
=
False
current_x
=
0
current_x
=
0
current_y
=
0
current_y
=
0
...
@@ -200,6 +202,7 @@ class GCode(object):
...
@@ -200,6 +202,7 @@ class GCode(object):
#checks for G20, G21, G90 and G91, sets imperial and relative flags
#checks for G20, G21, G90 and G91, sets imperial and relative flags
imperial
=
False
imperial
=
False
relative
=
False
relative
=
False
relative_e
=
False
for
line
in
self
.
lines
:
for
line
in
self
.
lines
:
if
line
.
command
()
==
"G20"
:
if
line
.
command
()
==
"G20"
:
imperial
=
True
imperial
=
True
...
@@ -207,11 +210,18 @@ class GCode(object):
...
@@ -207,11 +210,18 @@ class GCode(object):
imperial
=
False
imperial
=
False
elif
line
.
command
()
==
"G90"
:
elif
line
.
command
()
==
"G90"
:
relative
=
False
relative
=
False
relative_e
=
False
elif
line
.
command
()
==
"G91"
:
elif
line
.
command
()
==
"G91"
:
relative
=
True
relative
=
True
relative_e
=
True
elif
line
.
command
()
==
"M82"
:
relative_e
=
False
elif
line
.
command
()
==
"M83"
:
relative_e
=
True
elif
line
.
is_move
():
elif
line
.
is_move
():
line
.
imperial
=
imperial
line
.
imperial
=
imperial
line
.
relative
=
relative
line
.
relative
=
relative
line
.
relative_e
=
relative_e
def
_create_layers
(
self
):
def
_create_layers
(
self
):
self
.
layers
=
[]
self
.
layers
=
[]
...
@@ -316,7 +326,7 @@ class GCode(object):
...
@@ -316,7 +326,7 @@ class GCode(object):
total_e
+=
cur_e
total_e
+=
cur_e
cur_e
=
line
.
e
cur_e
=
line
.
e
elif
line
.
is_move
()
and
line
.
e
:
elif
line
.
is_move
()
and
line
.
e
:
if
line
.
relative
:
if
line
.
relative
_e
:
cur_e
+=
line
.
e
cur_e
+=
line
.
e
else
:
else
:
cur_e
=
line
.
e
cur_e
=
line
.
e
...
...
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