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
c45b2b60
Commit
c45b2b60
authored
Jul 13, 2013
by
Felipe Acebes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix error with spaces in printcore
parent
836db39d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
printcore.py
printcore.py
+13
-13
No files found.
printcore.py
View file @
c45b2b60
...
@@ -94,7 +94,7 @@ class printcore():
...
@@ -94,7 +94,7 @@ class printcore():
self
.
xy_feedrate
=
None
self
.
xy_feedrate
=
None
self
.
z_feedrate
=
None
self
.
z_feedrate
=
None
self
.
pronterface
=
None
self
.
pronterface
=
None
@
locked
@
locked
def
disconnect
(
self
):
def
disconnect
(
self
):
"""Disconnects from printer and pauses the print
"""Disconnects from printer and pauses the print
...
@@ -112,8 +112,8 @@ class printcore():
...
@@ -112,8 +112,8 @@ class printcore():
self
.
printer
.
close
()
self
.
printer
.
close
()
except
socket
.
error
:
except
socket
.
error
:
pass
pass
except
OSError
:
except
OSError
:
pass
pass
self
.
printer
=
None
self
.
printer
=
None
self
.
online
=
False
self
.
online
=
False
self
.
printing
=
False
self
.
printing
=
False
...
@@ -333,7 +333,7 @@ class printcore():
...
@@ -333,7 +333,7 @@ class printcore():
self
.
print_thread
.
start
()
self
.
print_thread
.
start
()
return
True
return
True
# run a simple script if it exists, no multithreading
# run a simple script if it exists, no multithreading
def
runSmallScript
(
self
,
filename
):
def
runSmallScript
(
self
,
filename
):
if
filename
==
None
:
return
if
filename
==
None
:
return
f
=
None
f
=
None
...
@@ -348,22 +348,22 @@ class printcore():
...
@@ -348,22 +348,22 @@ class printcore():
l
=
l
[:
l
.
find
(
";"
)]
#remove comment
l
=
l
[:
l
.
find
(
";"
)]
#remove comment
self
.
send_now
(
l
)
self
.
send_now
(
l
)
f
.
close
()
f
.
close
()
def
pause
(
self
):
def
pause
(
self
):
"""Pauses the print, saving the current position.
"""Pauses the print, saving the current position.
"""
"""
if
not
self
.
printing
:
return
False
if
not
self
.
printing
:
return
False
self
.
paused
=
True
self
.
paused
=
True
self
.
printing
=
False
self
.
printing
=
False
# try joining the print thread: enclose it in try/except because we might be calling it from the thread itself
# try joining the print thread: enclose it in try/except because we might be calling it from the thread itself
try
:
try
:
self
.
print_thread
.
join
()
self
.
print_thread
.
join
()
except
:
except
:
pass
pass
self
.
print_thread
=
None
self
.
print_thread
=
None
# saves the status
# saves the status
self
.
pauseX
=
self
.
analyzer
.
x
-
self
.
analyzer
.
xOffset
;
self
.
pauseX
=
self
.
analyzer
.
x
-
self
.
analyzer
.
xOffset
;
self
.
pauseY
=
self
.
analyzer
.
y
-
self
.
analyzer
.
yOffset
;
self
.
pauseY
=
self
.
analyzer
.
y
-
self
.
analyzer
.
yOffset
;
...
@@ -379,7 +379,7 @@ class printcore():
...
@@ -379,7 +379,7 @@ class printcore():
if
self
.
paused
:
if
self
.
paused
:
#restores the status
#restores the status
self
.
send_now
(
"G90"
)
# go to absolute coordinates
self
.
send_now
(
"G90"
)
# go to absolute coordinates
xyFeedString
=
""
xyFeedString
=
""
zFeedString
=
""
zFeedString
=
""
if
self
.
xy_feedrate
!=
None
:
xyFeedString
=
" F"
+
str
(
self
.
xy_feedrate
)
if
self
.
xy_feedrate
!=
None
:
xyFeedString
=
" F"
+
str
(
self
.
xy_feedrate
)
...
@@ -388,11 +388,11 @@ class printcore():
...
@@ -388,11 +388,11 @@ class printcore():
self
.
send_now
(
"G1 X"
+
str
(
self
.
pauseX
)
+
" Y"
+
str
(
self
.
pauseY
)
+
xyFeedString
)
self
.
send_now
(
"G1 X"
+
str
(
self
.
pauseX
)
+
" Y"
+
str
(
self
.
pauseY
)
+
xyFeedString
)
self
.
send_now
(
"G1 Z"
+
str
(
self
.
pauseZ
)
+
zFeedString
)
self
.
send_now
(
"G1 Z"
+
str
(
self
.
pauseZ
)
+
zFeedString
)
self
.
send_now
(
"G92 E"
+
str
(
self
.
pauseE
))
self
.
send_now
(
"G92 E"
+
str
(
self
.
pauseE
))
if
self
.
pauseRelative
:
self
.
send_now
(
"G91"
)
# go back to relative if needed
if
self
.
pauseRelative
:
self
.
send_now
(
"G91"
)
# go back to relative if needed
#reset old feed rate
#reset old feed rate
self
.
send_now
(
"G1 F"
+
str
(
self
.
pauseF
))
self
.
send_now
(
"G1 F"
+
str
(
self
.
pauseF
))
self
.
paused
=
False
self
.
paused
=
False
self
.
printing
=
True
self
.
printing
=
True
self
.
print_thread
=
Thread
(
target
=
self
.
_print
,
kwargs
=
{
"resuming"
:
True
})
self
.
print_thread
=
Thread
(
target
=
self
.
_print
,
kwargs
=
{
"resuming"
:
True
})
...
@@ -453,7 +453,7 @@ class printcore():
...
@@ -453,7 +453,7 @@ class printcore():
self
.
pronterface
.
pause
(
None
)
self
.
pronterface
.
pause
(
None
)
else
:
else
:
self
.
pause
()
self
.
pause
()
def
_sendnext
(
self
):
def
_sendnext
(
self
):
if
not
self
.
printer
:
if
not
self
.
printer
:
return
return
...
@@ -497,7 +497,7 @@ class printcore():
...
@@ -497,7 +497,7 @@ class printcore():
self
.
queueindex
+=
1
self
.
queueindex
+=
1
self
.
clear
=
True
self
.
clear
=
True
return
return
tline
=
tline
.
split
(
";"
)[
0
]
tline
=
tline
.
split
(
";"
)[
0
]
if
len
(
tline
)
>
0
:
if
len
(
tline
)
>
0
:
self
.
_send
(
tline
,
self
.
lineno
,
True
)
self
.
_send
(
tline
,
self
.
lineno
,
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