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
a27a757e
Commit
a27a757e
authored
Mar 29, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add layers_count and all_zs properties to GCoder and use them
Also fix the wrong behavior of estimate_duration on new calls
parent
8b49127a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
gcoder.py
printrun/gcoder.py
+12
-4
No files found.
printrun/gcoder.py
View file @
a27a757e
...
@@ -182,6 +182,14 @@ class GCode(object):
...
@@ -182,6 +182,14 @@ class GCode(object):
self
.
home_x
,
self
.
home_y
,
self
.
home_z
=
home_pos
self
.
home_x
,
self
.
home_y
,
self
.
home_z
=
home_pos
home_pos
=
property
(
_get_home_pos
,
_set_home_pos
)
home_pos
=
property
(
_get_home_pos
,
_set_home_pos
)
def
_get_all_zs
(
self
):
return
set
((
layer
.
z
for
layer
in
self
.
all_layers
if
layer
.
z
is
not
None
))
all_zs
=
property
(
_get_all_zs
)
def
_get_layers_count
(
self
):
return
len
(
self
.
all_zs
)
layers_count
=
property
(
_get_layers_count
)
def
__init__
(
self
,
data
=
None
,
home_pos
=
None
):
def
__init__
(
self
,
data
=
None
,
home_pos
=
None
):
self
.
home_pos
=
home_pos
self
.
home_pos
=
home_pos
if
data
:
if
data
:
...
@@ -478,7 +486,7 @@ class GCode(object):
...
@@ -478,7 +486,7 @@ class GCode(object):
def
estimate_duration
(
self
):
def
estimate_duration
(
self
):
if
self
.
duration
is
not
None
:
if
self
.
duration
is
not
None
:
return
self
.
duration
return
self
.
layers_count
,
self
.
duration
lastx
=
lasty
=
lastz
=
laste
=
lastf
=
0.0
lastx
=
lasty
=
lastz
=
laste
=
lastf
=
0.0
lastdx
=
0
lastdx
=
0
lastdy
=
0
lastdy
=
0
...
@@ -569,7 +577,7 @@ class GCode(object):
...
@@ -569,7 +577,7 @@ class GCode(object):
totaltime
=
datetime
.
timedelta
(
seconds
=
int
(
totalduration
))
totaltime
=
datetime
.
timedelta
(
seconds
=
int
(
totalduration
))
self
.
duration
=
totaltime
self
.
duration
=
totaltime
return
"
%
d layers,
%
s"
%
(
len
(
self
.
layers
),
str
(
totaltime
)
)
return
self
.
layers_count
,
str
(
totaltime
)
def
main
():
def
main
():
if
len
(
sys
.
argv
)
<
2
:
if
len
(
sys
.
argv
)
<
2
:
...
@@ -587,8 +595,8 @@ def main():
...
@@ -587,8 +595,8 @@ def main():
zdims
=
(
gcode
.
zmin
,
gcode
.
zmax
,
gcode
.
height
)
zdims
=
(
gcode
.
zmin
,
gcode
.
zmax
,
gcode
.
height
)
print
"
\t
Z:
%0.02
f -
%0.02
f (
%0.02
f)"
%
zdims
print
"
\t
Z:
%0.02
f -
%0.02
f (
%0.02
f)"
%
zdims
print
"Filament used:
%0.02
fmm"
%
gcode
.
filament_length
print
"Filament used:
%0.02
fmm"
%
gcode
.
filament_length
print
"Number of layers:
%
d"
%
gcode
.
num_layers
()
print
"Number of layers:
%
d"
%
gcode
.
layers_count
print
"Estimated duration:
%
s"
%
gcode
.
estimate_duration
()
print
"Estimated duration:
%
s"
%
gcode
.
estimate_duration
()
[
1
]
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
()
main
()
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