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
bbae212b
Commit
bbae212b
authored
Jul 09, 2013
by
D1plo1d
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a fast gcode replacement for prontserve since it doesn't use or need gcode's functionality
parent
c317d3e2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
7 deletions
+48
-7
gcoder.py
printrun/gcoder.py
+5
-6
prontserve.py
prontserve.py
+43
-1
No files found.
printrun/gcoder.py
View file @
bbae212b
...
@@ -155,11 +155,10 @@ class GCode(object):
...
@@ -155,11 +155,10 @@ class GCode(object):
depth
=
None
depth
=
None
height
=
None
height
=
None
def
__init__
(
self
,
data
,
preprocess
=
True
):
def
__init__
(
self
,
data
):
self
.
lines
=
[
Line
(
l2
)
for
l2
in
self
.
lines
=
[
Line
(
l2
)
for
l2
in
(
l
.
strip
()
for
l
in
data
)
(
l
.
strip
()
for
l
in
data
)
if
l2
]
if
l2
]
if
preprocess
==
True
:
self
.
_preprocess_lines
()
self
.
_preprocess_lines
()
self
.
filament_length
=
self
.
_preprocess_extrusion
()
self
.
filament_length
=
self
.
_preprocess_extrusion
()
self
.
_create_layers
()
self
.
_create_layers
()
...
...
prontserve.py
View file @
bbae212b
...
@@ -402,6 +402,48 @@ class EventEmitter(object):
...
@@ -402,6 +402,48 @@ class EventEmitter(object):
continue
continue
# Fast GCode. Because the GCode class is slow.
# -------------------------------------------------
class
PyLine
(
object
):
__slots__
=
(
'x'
,
'y'
,
'z'
,
'e'
,
'f'
,
'i'
,
'j'
,
'raw'
,
'command'
,
'is_move'
,
'relative'
,
'relative_e'
,
'current_x'
,
'current_y'
,
'current_z'
,
'extruding'
,
'current_tool'
,
'gcview_end_vertex'
)
def
__init__
(
self
,
l
):
self
.
raw
=
l
def
__getattr__
(
self
,
name
):
return
None
try
:
from
printrun
import
gcoder_line
Line
=
gcoder_line
.
GLine
except
ImportError
:
Line
=
PyLine
class
FastGCode
(
object
):
def
__init__
(
self
,
data
):
self
.
lines
=
[
Line
(
l2
)
for
l2
in
(
l
.
strip
()
for
l
in
data
)
if
l2
]
self
.
all_layers
=
[
self
.
lines
]
def
__len__
(
self
):
return
len
(
self
.
lines
)
def
__iter__
(
self
):
return
self
.
lines
.
__iter__
()
def
idxs
(
self
,
index
):
print
len
(
self
.
lines
)
print
index
return
(
0
,
index
)
# Prontserve: Server-specific functionality
# Prontserve: Server-specific functionality
# -------------------------------------------------
# -------------------------------------------------
...
@@ -594,7 +636,7 @@ class Prontserve(pronsole.pronsole, EventEmitter):
...
@@ -594,7 +636,7 @@ class Prontserve(pronsole.pronsole, EventEmitter):
print
"Starting the next print job"
print
"Starting the next print job"
self
.
current_job
=
self
.
jobs
.
list
.
pop
(
0
)
self
.
current_job
=
self
.
jobs
.
list
.
pop
(
0
)
lines
=
self
.
current_job
[
'body'
]
.
split
(
"
\n
"
)
lines
=
self
.
current_job
[
'body'
]
.
split
(
"
\n
"
)
gc
=
gcoder
.
GCode
(
lines
,
preprocess
=
False
)
gc
=
FastGCode
(
lines
)
self
.
p
.
startprint
(
gc
)
self
.
p
.
startprint
(
gc
)
self
.
p
.
paused
=
False
self
.
p
.
paused
=
False
self
.
fire
(
"job_started"
,
self
.
jobs
.
sanitize
(
self
.
current_job
))
self
.
fire
(
"job_started"
,
self
.
jobs
.
sanitize
(
self
.
current_job
))
...
...
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