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
Show 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():
self
.
maxX
=
150
self
.
maxY
=
150
self
.
maxZ
=
150
self
.
minX
=
0
self
.
minY
=
0
self
.
minZ
=
0
self
.
hasHomeX
=
False
self
.
hasHomeY
=
False
self
.
hasHomeZ
=
False
...
...
@@ -65,8 +68,8 @@ class GCodeAnalyzer():
# find a code in a gstring line
def
findCode
(
self
,
gcode
,
codeStr
):
pattern
=
re
.
compile
(
codeStr
+
"
s*([
\
d.
]*)"
,
re
.
I
)
m
=
re
.
mat
ch
(
pattern
,
gcode
)
pattern
=
re
.
compile
(
codeStr
+
"
\\
s*([
\
d.-
]*)"
,
re
.
I
)
m
=
re
.
sear
ch
(
pattern
,
gcode
)
if
m
==
None
:
return
None
else
:
...
...
@@ -85,7 +88,7 @@ class GCodeAnalyzer():
self
.
lastY
=
self
.
y
self
.
lastZ
=
self
.
z
self
.
lastE
=
self
.
e
eChanged
=
f
alse
;
eChanged
=
F
alse
;
code_f
=
self
.
findCode
(
gcode
,
"F"
)
if
code_f
!=
None
:
self
.
f
=
float
(
code_f
)
...
...
@@ -120,6 +123,14 @@ class GCodeAnalyzer():
if
self
.
e
!=
self
.
eOffset
+
e
:
eChanged
=
True
self
.
e
=
self
.
eOffset
+
e
#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
:
self
.
lastX
=
self
.
x
...
...
@@ -194,4 +205,7 @@ class GCodeAnalyzer():
if
code_m
==
82
:
self
.
eRelative
=
False
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():
self
.
print_thread
=
None
if
port
is
not
None
and
baud
is
not
None
:
self
.
connect
(
port
,
baud
)
self
.
analyzer
=
GCodeAnalyzer
()
self
.
xy_feedrate
=
None
self
.
z_feedrate
=
None
def
disconnect
(
self
):
"""Disconnects from printer and pauses the print
...
...
@@ -230,9 +231,37 @@ class printcore():
self
.
print_thread
.
join
()
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
):
"""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
.
printing
=
True
self
.
print_thread
=
Thread
(
target
=
self
.
_print
)
...
...
pronterface.py
View file @
00f1306f
...
...
@@ -128,6 +128,23 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
btndict
=
{}
self
.
parse_cmdline
(
sys
.
argv
[
1
:])
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
)
customdict
=
{}
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