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
c4884cf1
Commit
c4884cf1
authored
Nov 07, 2011
by
kliment
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #75 from sdevijver/master
Print time guesstimation on file load
parents
d84e1085
262b000f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
+55
-0
pronsole.py
pronsole.py
+54
-0
pronterface.py
pronterface.py
+1
-0
No files found.
pronsole.py
View file @
c4884cf1
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
cmd
,
printcore
,
sys
import
cmd
,
printcore
,
sys
import
glob
,
os
,
time
import
glob
,
os
,
time
import
sys
,
subprocess
import
sys
,
subprocess
from
math
import
sqrt
if
os
.
name
==
"nt"
:
if
os
.
name
==
"nt"
:
try
:
try
:
import
_winreg
import
_winreg
...
@@ -80,6 +81,59 @@ def totalelength(g):
...
@@ -80,6 +81,59 @@ def totalelength(g):
tot
+=
cur
tot
+=
cur
return
tot
return
tot
def
get_coordinate_value
(
axis
,
parts
):
for
i
in
parts
:
if
(
axis
in
i
):
return
float
(
i
[
1
:])
return
None
def
estimate_duration
(
g
):
extra_cost_per_movement
=
0.02
total_duration
=
0
feedrate
=
0
X_last_position
=
0
Y_last_position
=
0
for
i
in
g
:
if
"G1"
in
i
and
(
"X"
in
i
or
"Y"
in
i
or
"F"
in
i
or
"E"
in
i
):
parts
=
i
.
split
(
" "
)
X
=
get_coordinate_value
(
"X"
,
parts
[
1
:])
Y
=
get_coordinate_value
(
"Y"
,
parts
[
1
:])
F
=
get_coordinate_value
(
"F"
,
parts
[
1
:])
E
=
get_coordinate_value
(
"E"
,
parts
[
1
:])
if
(
F
is
not
None
):
feedrate
=
F
/
60
distance
=
0
if
(
X
is
None
and
Y
is
None
and
E
is
not
None
):
distance
=
abs
(
E
)
elif
(
X
is
not
None
and
Y
is
None
):
distance
=
X
-
X_last_position
X_last_position
=
X
elif
(
X
is
None
and
Y
is
not
None
):
distance
=
Y
-
Y_last_position
Y_last_position
=
Y
elif
(
X
is
not
None
and
Y
is
not
None
):
X_distance
=
X
-
X_last_position
Y_distance
=
Y
-
Y_last_position
distance
=
sqrt
(
X_distance
*
X_distance
+
Y_distance
*
Y_distance
)
X_last_position
=
X
Y_last_position
=
Y
if
(
feedrate
==
0
or
distance
==
0
):
continue
time_for_move
=
distance
/
feedrate
acceleration
=
feedrate
/
time_for_move
halfway_feedrate
=
acceleration
*
time_for_move
/
2
duration
=
halfway_feedrate
*
2
/
acceleration
total_duration
+=
duration
+
extra_cost_per_movement
mod_minutes
=
total_duration
%
(
60
*
60
)
mod_seconds
=
mod_minutes
%
60
return
"{0:02d}h{1:02d}m"
.
format
(
int
((
total_duration
-
mod_minutes
)
/
(
60
*
60
)),
int
((
mod_minutes
-
mod_seconds
)
/
60
))
class
Settings
:
class
Settings
:
#def _temperature_alias(self): return {"pla":210,"abs":230,"off":0}
#def _temperature_alias(self): return {"pla":210,"abs":230,"off":0}
...
...
pronterface.py
View file @
c4884cf1
...
@@ -1166,6 +1166,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1166,6 +1166,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
print
_
(
"the print goes from"
),
Xmin
,
_
(
"mm to"
),
Xmax
,
_
(
"mm in X
\n
and is"
),
Xtot
,
_
(
"mm wide
\n
"
)
print
_
(
"the print goes from"
),
Xmin
,
_
(
"mm to"
),
Xmax
,
_
(
"mm in X
\n
and is"
),
Xtot
,
_
(
"mm wide
\n
"
)
print
_
(
"the print goes from"
),
Ymin
,
_
(
"mm to"
),
Ymax
,
_
(
"mm in Y
\n
and is"
),
Ytot
,
_
(
"mm wide
\n
"
)
print
_
(
"the print goes from"
),
Ymin
,
_
(
"mm to"
),
Ymax
,
_
(
"mm in Y
\n
and is"
),
Ytot
,
_
(
"mm wide
\n
"
)
print
_
(
"the print goes from"
),
Zmin
,
_
(
"mm to"
),
Zmax
,
_
(
"mm in Z
\n
and is"
),
Ztot
,
_
(
"mm high
\n
"
)
print
_
(
"the print goes from"
),
Zmin
,
_
(
"mm to"
),
Zmax
,
_
(
"mm in Z
\n
and is"
),
Ztot
,
_
(
"mm high
\n
"
)
print
_
(
"Estimated duration (pessimistic): "
),
pronsole
.
estimate_duration
(
self
.
f
)
self
.
gviz
.
clear
()
self
.
gviz
.
clear
()
self
.
gwindow
.
p
.
clear
()
self
.
gwindow
.
p
.
clear
()
for
i
in
self
.
f
:
for
i
in
self
.
f
:
...
...
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