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
00f1306f
Commit
00f1306f
authored
Apr 06, 2013
by
fsantini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfixes in the analyzer
Pause code (Ported from RepetierHost, untested)
parent
6cf08006
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
7 deletions
+67
-7
GCodeAnalyzer.py
GCodeAnalyzer.py
+20
-6
printcore.py
printcore.py
+30
-1
pronterface.py
pronterface.py
+17
-0
No files found.
GCodeAnalyzer.py
View file @
00f1306f
...
@@ -58,6 +58,9 @@ class GCodeAnalyzer():
...
@@ -58,6 +58,9 @@ class GCodeAnalyzer():
self
.
maxX
=
150
self
.
maxX
=
150
self
.
maxY
=
150
self
.
maxY
=
150
self
.
maxZ
=
150
self
.
maxZ
=
150
self
.
minX
=
0
self
.
minY
=
0
self
.
minZ
=
0
self
.
hasHomeX
=
False
self
.
hasHomeX
=
False
self
.
hasHomeY
=
False
self
.
hasHomeY
=
False
self
.
hasHomeZ
=
False
self
.
hasHomeZ
=
False
...
@@ -65,8 +68,8 @@ class GCodeAnalyzer():
...
@@ -65,8 +68,8 @@ class GCodeAnalyzer():
# find a code in a gstring line
# find a code in a gstring line
def
findCode
(
self
,
gcode
,
codeStr
):
def
findCode
(
self
,
gcode
,
codeStr
):
pattern
=
re
.
compile
(
codeStr
+
"
s*([
\
d.
]*)"
,
re
.
I
)
pattern
=
re
.
compile
(
codeStr
+
"
\\
s*([
\
d.-
]*)"
,
re
.
I
)
m
=
re
.
mat
ch
(
pattern
,
gcode
)
m
=
re
.
sear
ch
(
pattern
,
gcode
)
if
m
==
None
:
if
m
==
None
:
return
None
return
None
else
:
else
:
...
@@ -85,7 +88,7 @@ class GCodeAnalyzer():
...
@@ -85,7 +88,7 @@ class GCodeAnalyzer():
self
.
lastY
=
self
.
y
self
.
lastY
=
self
.
y
self
.
lastZ
=
self
.
z
self
.
lastZ
=
self
.
z
self
.
lastE
=
self
.
e
self
.
lastE
=
self
.
e
eChanged
=
f
alse
;
eChanged
=
F
alse
;
code_f
=
self
.
findCode
(
gcode
,
"F"
)
code_f
=
self
.
findCode
(
gcode
,
"F"
)
if
code_f
!=
None
:
if
code_f
!=
None
:
self
.
f
=
float
(
code_f
)
self
.
f
=
float
(
code_f
)
...
@@ -94,7 +97,7 @@ class GCodeAnalyzer():
...
@@ -94,7 +97,7 @@ class GCodeAnalyzer():
code_y
=
self
.
findCode
(
gcode
,
"Y"
)
code_y
=
self
.
findCode
(
gcode
,
"Y"
)
code_z
=
self
.
findCode
(
gcode
,
"Z"
)
code_z
=
self
.
findCode
(
gcode
,
"Z"
)
code_e
=
self
.
findCode
(
gcode
,
"E"
)
code_e
=
self
.
findCode
(
gcode
,
"E"
)
if
self
.
relative
:
if
self
.
relative
:
if
code_x
!=
None
:
self
.
x
+=
float
(
code_x
)
if
code_x
!=
None
:
self
.
x
+=
float
(
code_x
)
if
code_y
!=
None
:
self
.
y
+=
float
(
code_y
)
if
code_y
!=
None
:
self
.
y
+=
float
(
code_y
)
...
@@ -120,7 +123,15 @@ class GCodeAnalyzer():
...
@@ -120,7 +123,15 @@ class GCodeAnalyzer():
if
self
.
e
!=
self
.
eOffset
+
e
:
if
self
.
e
!=
self
.
eOffset
+
e
:
eChanged
=
True
eChanged
=
True
self
.
e
=
self
.
eOffset
+
e
self
.
e
=
self
.
eOffset
+
e
#Repetier has a bunch of limit-checking code here and time calculations: we are leaving them for now
#limit checking
if
self
.
x
<
self
.
minX
:
self
.
x
=
self
.
minX
if
self
.
y
<
self
.
minY
:
self
.
y
=
self
.
minY
if
self
.
z
<
self
.
minZ
:
self
.
z
=
self
.
minZ
if
self
.
x
>
self
.
maxX
:
self
.
x
=
self
.
maxX
if
self
.
y
>
self
.
maxY
:
self
.
y
=
self
.
maxY
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
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
...
@@ -193,5 +204,8 @@ class GCodeAnalyzer():
...
@@ -193,5 +204,8 @@ class GCodeAnalyzer():
code_m
=
int
(
code_m
)
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
def
print_status
(
self
):
attrs
=
vars
(
self
)
print
'
\n
'
.
join
(
"
%
s:
%
s"
%
item
for
item
in
attrs
.
items
())
\ No newline at end of file
printcore.py
View file @
00f1306f
...
@@ -70,8 +70,9 @@ class printcore():
...
@@ -70,8 +70,9 @@ class printcore():
self
.
print_thread
=
None
self
.
print_thread
=
None
if
port
is
not
None
and
baud
is
not
None
:
if
port
is
not
None
and
baud
is
not
None
:
self
.
connect
(
port
,
baud
)
self
.
connect
(
port
,
baud
)
self
.
analyzer
=
GCodeAnalyzer
()
self
.
analyzer
=
GCodeAnalyzer
()
self
.
xy_feedrate
=
None
self
.
z_feedrate
=
None
def
disconnect
(
self
):
def
disconnect
(
self
):
"""Disconnects from printer and pauses the print
"""Disconnects from printer and pauses the print
...
@@ -229,10 +230,38 @@ class printcore():
...
@@ -229,10 +230,38 @@ class printcore():
self
.
printing
=
False
self
.
printing
=
False
self
.
print_thread
.
join
()
self
.
print_thread
.
join
()
self
.
print_thread
=
None
self
.
print_thread
=
None
# saves the status
self
.
pauseX
=
analyzer
.
x
-
analyzer
.
xOffset
;
self
.
pauseY
=
analyzer
.
y
-
analyzer
.
yOffset
;
self
.
pauseZ
=
analyzer
.
z
-
analyzer
.
zOffset
;
self
.
pauseE
=
analyzer
.
e
-
analyzer
.
eOffset
;
self
.
pauseF
=
analyzer
.
f
;
self
.
pauseRelative
=
analyzer
.
relative
;
def
resume
(
self
):
def
resume
(
self
):
"""Resumes a paused print.
"""Resumes a paused print.
"""
"""
if
self
.
paused
:
#restores the status
self
.
send
(
"G90"
)
# go to absolute coordinates
xyFeedString
=
""
zFeedString
=
""
if
self
.
xy_feedrate
!=
None
:
xyFeedString
=
" F"
+
str
(
self
.
xy_feedrate
)
if
self
.
z_feedrate
!=
None
:
zFeedString
=
" F"
+
str
(
self
.
z_feedrate
)
self
.
send
(
"G1 X"
+
str
(
self
.
pauseX
)
+
" Y"
+
str
(
self
.
pauseY
)
+
xyFeedString
)
self
.
send
(
"G1 Z"
+
str
(
self
.
pauseZ
)
+
zFeedString
)
self
.
send
(
"G92 E"
+
str
(
self
.
pauseE
))
if
self
.
pauseRelative
:
self
.
send
(
"G91"
)
# go back to relative if needed
#reset old feed rate
self
.
send
(
"G1 F"
+
str
(
self
.
pauseF
))
self
.
paused
=
False
self
.
paused
=
False
self
.
printing
=
True
self
.
printing
=
True
self
.
print_thread
=
Thread
(
target
=
self
.
_print
)
self
.
print_thread
=
Thread
(
target
=
self
.
_print
)
...
...
pronterface.py
View file @
00f1306f
...
@@ -128,6 +128,23 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -128,6 +128,23 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
btndict
=
{}
self
.
btndict
=
{}
self
.
parse_cmdline
(
sys
.
argv
[
1
:])
self
.
parse_cmdline
(
sys
.
argv
[
1
:])
self
.
build_dimensions_list
=
self
.
get_build_dimensions
(
self
.
settings
.
build_dimensions
)
self
.
build_dimensions_list
=
self
.
get_build_dimensions
(
self
.
settings
.
build_dimensions
)
#initialize the code analyzer with the correct sizes. There must be a more general way to do so
self
.
p
.
analyzer
.
maxX
=
self
.
build_dimensions_list
[
0
];
self
.
p
.
analyzer
.
maxY
=
self
.
build_dimensions_list
[
1
];
self
.
p
.
analyzer
.
maxZ
=
self
.
build_dimensions_list
[
2
];
self
.
p
.
analyzer
.
homeX
=
self
.
build_dimensions_list
[
3
];
self
.
p
.
analyzer
.
homeY
=
self
.
build_dimensions_list
[
4
];
self
.
p
.
analyzer
.
homeZ
=
self
.
build_dimensions_list
[
5
];
self
.
p
.
analyzer
.
print_status
()
#set feedrates in printcore for pause/resume
self
.
p
.
xy_feedrate
=
self
.
settings
.
xy_feedrate
self
.
p
.
z_feedrate
=
self
.
settings
.
z_feedrate
self
.
panel
.
SetBackgroundColour
(
self
.
settings
.
bgcolor
)
self
.
panel
.
SetBackgroundColour
(
self
.
settings
.
bgcolor
)
customdict
=
{}
customdict
=
{}
try
:
try
:
...
...
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