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
4ab81175
Commit
4ab81175
authored
Jun 02, 2011
by
kliment
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add skeinforge settings support. Make printing non-modal. Experimental pausing.
parent
7fd5c664
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
18 deletions
+57
-18
printcore.py
printcore.py
+9
-4
pronsole.py
pronsole.py
+48
-14
No files found.
printcore.py
View file @
4ab81175
...
...
@@ -19,6 +19,7 @@ class printcore():
self
.
queueindex
=
0
self
.
lineno
=
0
self
.
resendfrom
=-
1
self
.
paused
=
False
self
.
sentlines
=
{}
self
.
log
=
[]
self
.
sent
=
[]
...
...
@@ -62,7 +63,7 @@ class printcore():
"""This function acts on messages from the firmware
"""
self
.
clear
=
True
time
.
sleep
(
1
)
time
.
sleep
(
0.5
)
self
.
send_now
(
"M105"
)
while
(
True
):
if
(
not
self
.
printer
or
not
self
.
printer
.
isOpen
):
...
...
@@ -124,12 +125,14 @@ class printcore():
def
pause
(
self
):
"""Pauses the print, saving the current position.
"""
self
.
paused
=
True
self
.
printing
=
False
time
.
sleep
(
1
)
def
resume
(
self
):
"""Resumes a paused print.
"""
self
.
paused
=
False
self
.
printing
=
True
Thread
(
target
=
self
.
_print
)
.
start
()
...
...
@@ -194,9 +197,11 @@ class printcore():
self
.
queueindex
+=
1
else
:
self
.
printing
=
False
self
.
queueindex
=
0
self
.
lineno
=
0
self
.
_send
(
"M110"
,
-
1
,
True
)
self
.
clear
=
True
if
(
not
self
.
paused
):
self
.
queueindex
=
0
self
.
lineno
=
0
self
.
_send
(
"M110"
,
-
1
,
True
)
def
_send
(
self
,
command
,
lineno
=
0
,
calcchecksum
=
False
):
if
(
calcchecksum
):
...
...
pronsole.py
View file @
4ab81175
...
...
@@ -291,17 +291,39 @@ class pronsole(cmd.Cmd):
print
"Not connected to printer."
return
print
(
"Printing "
+
self
.
filename
)
print
(
"
Press Ctrl-C to interrupt print (you can resume it with the resume command)
"
)
print
(
"
You can monitor the print with the monitor command.
"
)
self
.
p
.
startprint
(
self
.
f
)
self
.
p
.
pause
()
#self.p.pause()
#self.paused=True
#self.do_resume(None)
def
do_pause
(
self
,
l
):
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M25"
)
else
:
if
(
not
self
.
p
.
printing
):
print
"Not printing, cannot pause."
return
self
.
p
.
pause
()
self
.
p
.
connect
()
# This seems to work, but is not a good solution.
self
.
paused
=
True
self
.
do_resume
(
None
)
#self.do_resume(None)
def
help_pause
(
self
,
l
):
print
"Pauses a running print"
def
do_resume
(
self
,
l
):
if
not
self
.
paused
:
print
"Not paused, unable to resume. Start a print first."
return
self
.
paused
=
False
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M24"
)
return
else
:
self
.
p
.
resume
()
return
try
:
self
.
p
.
resume
()
#print self.p.printing
...
...
@@ -652,6 +674,9 @@ class pronsole(cmd.Cmd):
if
(
self
.
sdprinting
):
self
.
p
.
send_now
(
"M27"
)
print
(
self
.
tempreadings
.
replace
(
"
\r
"
,
""
)
.
replace
(
"T"
,
"Hotend"
)
.
replace
(
"B"
,
"Bed"
)
.
replace
(
"
\n
"
,
""
)
.
replace
(
"ok "
,
""
))
if
(
self
.
p
.
printing
):
print
"Print progress: "
,
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
),
"
%
"
if
(
self
.
sdprinting
):
print
"SD print progress: "
,
self
.
percentdone
,
"
%
"
time
.
sleep
(
interval
)
...
...
@@ -669,10 +694,14 @@ class pronsole(cmd.Cmd):
if
len
(
l
)
==
0
:
print
"No file name given."
return
print
"Skeining file:"
+
l
[
0
]
if
not
(
os
.
path
.
exists
(
l
[
0
])):
print
"File not found!"
return
settings
=
0
if
(
l
[
0
]
==
"set"
):
settings
=
1
else
:
print
"Skeining file:"
+
l
[
0
]
if
not
(
os
.
path
.
exists
(
l
[
0
])):
print
"File not found!"
return
if
not
os
.
path
.
exists
(
"skeinforge"
):
print
"Skeinforge not found.
\n
Please copy Skeinforge into a directory named
\"
skeinforge
\"
in the same directory as this file."
return
...
...
@@ -681,15 +710,19 @@ class pronsole(cmd.Cmd):
pass
try
:
from
skeinforge.skeinforge_application.skeinforge_utilities
import
skeinforge_craft
if
(
len
(
l
)
>
1
):
if
(
l
[
1
]
==
"view"
):
skeinforge_craft
.
writeOutput
(
l
[
0
],
True
)
from
skeinforge.skeinforge_application
import
skeinforge
if
(
settings
):
skeinforge
.
main
()
else
:
if
(
len
(
l
)
>
1
):
if
(
l
[
1
]
==
"view"
):
skeinforge_craft
.
writeOutput
(
l
[
0
],
True
)
else
:
skeinforge_craft
.
writeOutput
(
l
[
0
],
False
)
else
:
skeinforge_craft
.
writeOutput
(
l
[
0
],
False
)
else
:
skeinforge_craft
.
writeOutput
(
l
[
0
],
False
)
print
"Loading skeined file."
self
.
do_load
(
l
[
0
]
.
replace
(
".stl"
,
"_export.gcode"
))
print
"Loading skeined file."
self
.
do_load
(
l
[
0
]
.
replace
(
".stl"
,
"_export.gcode"
))
except
:
print
"Skeinforge execution failed."
...
...
@@ -707,6 +740,7 @@ class pronsole(cmd.Cmd):
print
"Creates a gcode file from an stl model using skeinforge (with tab-completion)"
print
"skein filename.stl - create gcode file"
print
"skein filename.stl view - create gcode file and view using skeiniso"
print
"skein set - adjust skeinforge settings"
interp
=
pronsole
()
...
...
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