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
51e26180
Commit
51e26180
authored
Jun 01, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix major bug in GCodeAnalyzer which made it useless and maybe harmful
parent
c5fafabb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
GCodeAnalyzer.py
printrun/GCodeAnalyzer.py
+7
-2
No files found.
printrun/GCodeAnalyzer.py
View file @
51e26180
...
@@ -51,6 +51,7 @@ class GCodeAnalyzer():
...
@@ -51,6 +51,7 @@ class GCodeAnalyzer():
self
.
eOffset
=
0
self
.
eOffset
=
0
self
.
lastZPrint
=
0
self
.
lastZPrint
=
0
self
.
layerZ
=
0
self
.
layerZ
=
0
self
.
imperial
=
False
self
.
relative
=
False
self
.
relative
=
False
self
.
eRelative
=
False
self
.
eRelative
=
False
self
.
homeX
=
0
self
.
homeX
=
0
...
@@ -69,6 +70,7 @@ class GCodeAnalyzer():
...
@@ -69,6 +70,7 @@ class GCodeAnalyzer():
def
Analyze
(
self
,
gcode
):
def
Analyze
(
self
,
gcode
):
gline
=
gcoder
.
Line
(
gcode
)
gline
=
gcoder
.
Line
(
gcode
)
if
gline
.
command
.
startswith
(
";@"
):
return
# code is a host command
if
gline
.
command
.
startswith
(
";@"
):
return
# code is a host command
gline
.
parse_coordinates
(
self
.
imperial
)
code_g
=
int
(
gline
.
command
[
1
:])
if
gline
.
command
.
startswith
(
"G"
)
else
None
code_g
=
int
(
gline
.
command
[
1
:])
if
gline
.
command
.
startswith
(
"G"
)
else
None
code_m
=
int
(
gline
.
command
[
1
:])
if
gline
.
command
.
startswith
(
"M"
)
else
None
code_m
=
int
(
gline
.
command
[
1
:])
if
gline
.
command
.
startswith
(
"M"
)
else
None
...
@@ -97,7 +99,7 @@ class GCodeAnalyzer():
...
@@ -97,7 +99,7 @@ class GCodeAnalyzer():
eChanged
=
True
eChanged
=
True
self
.
e
+=
code_e
self
.
e
+=
code_e
else
:
else
:
#absolute coordinates
#
absolute coordinates
if
code_x
!=
None
:
self
.
x
=
self
.
xOffset
+
code_x
if
code_x
!=
None
:
self
.
x
=
self
.
xOffset
+
code_x
if
code_y
!=
None
:
self
.
y
=
self
.
yOffset
+
code_y
if
code_y
!=
None
:
self
.
y
=
self
.
yOffset
+
code_y
if
code_z
!=
None
:
self
.
z
=
self
.
zOffset
+
code_z
if
code_z
!=
None
:
self
.
z
=
self
.
zOffset
+
code_z
...
@@ -112,6 +114,7 @@ class GCodeAnalyzer():
...
@@ -112,6 +114,7 @@ class GCodeAnalyzer():
eChanged
=
True
eChanged
=
True
self
.
e
=
self
.
eOffset
+
code_e
self
.
e
=
self
.
eOffset
+
code_e
#limit checking
#limit checking
"""
if self.x < self.minX: self.x = self.minX
if self.x < self.minX: self.x = self.minX
if self.y < self.minY: self.y = self.minY
if self.y < self.minY: self.y = self.minY
if self.z < self.minZ: self.z = self.minZ
if self.z < self.minZ: self.z = self.minZ
...
@@ -119,7 +122,10 @@ class GCodeAnalyzer():
...
@@ -119,7 +122,10 @@ class GCodeAnalyzer():
if self.x > self.maxX: self.x = self.maxX
if self.x > self.maxX: self.x = self.maxX
if self.y > self.maxY: self.y = self.maxY
if self.y > self.maxY: self.y = self.maxY
if self.z > self.maxZ: self.z = self.maxZ
if self.z > self.maxZ: self.z = self.maxZ
"""
#Repetier has a bunch of limit-checking code here and time calculations: we are leaving them for now
#Repetier has a bunch of limit-checking code here and time calculations: we are leaving them for now
elif
code_g
==
20
:
self
.
imperial
=
True
elif
code_g
==
21
:
self
.
imperial
=
False
elif
code_g
==
28
or
code_g
==
161
:
elif
code_g
==
28
or
code_g
==
161
:
self
.
lastX
=
self
.
x
self
.
lastX
=
self
.
x
self
.
lastY
=
self
.
y
self
.
lastY
=
self
.
y
...
@@ -189,7 +195,6 @@ class GCodeAnalyzer():
...
@@ -189,7 +195,6 @@ class GCodeAnalyzer():
self
.
e
=
self
.
eOffset
self
.
e
=
self
.
eOffset
#End code_g != None
#End code_g != None
if
code_m
!=
None
:
if
code_m
!=
None
:
code_m
=
int
(
code_m
)
if
code_m
==
82
:
self
.
eRelative
=
False
if
code_m
==
82
:
self
.
eRelative
=
False
elif
code_m
==
83
:
self
.
eRelative
=
True
elif
code_m
==
83
:
self
.
eRelative
=
True
...
...
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