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
d706b876
Commit
d706b876
authored
Jul 29, 2013
by
D1plo1d
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:kliment/Printrun
parents
5bfee16a
46379470
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
7 deletions
+24
-7
gcoder.py
printrun/gcoder.py
+23
-6
printrun_utils.py
printrun/printrun_utils.py
+1
-1
No files found.
printrun/gcoder.py
View file @
d706b876
...
...
@@ -398,12 +398,14 @@ class GCode(object):
self
.
height
=
self
.
zmax
-
self
.
zmin
def
estimate_duration
(
self
):
lastx
=
lasty
=
laste
=
lastf
=
0.0
lastx
=
lasty
=
lastz
=
laste
=
lastf
=
0.0
lastdx
=
0
lastdy
=
0
x
=
y
=
e
=
f
=
0.0
currenttravel
=
0.0
moveduration
=
0.0
totalduration
=
0.0
acceleration
=
1500.0
# mm/s/s ASSUMING THE DEFAULT FROM SPRINTER !!!
acceleration
=
2000.0
# mm/s^2
layerbeginduration
=
0.0
#TODO:
# get device caps from firmware: max speed, acceleration/axis
...
...
@@ -422,6 +424,7 @@ class GCode(object):
else
:
x
=
line
.
x
if
line
.
x
is
not
None
else
lastx
y
=
line
.
y
if
line
.
y
is
not
None
else
lasty
z
=
line
.
z
if
line
.
z
is
not
None
else
lastz
e
=
line
.
e
if
line
.
e
is
not
None
else
laste
# mm/s vs mm/m => divide by 60
f
=
line
.
f
/
60.0
if
line
.
f
is
not
None
else
lastf
...
...
@@ -438,9 +441,19 @@ class GCode(object):
# subsquent moves are in opposite directions, as requested
# speed is constant but printer has to fully decellerate
# and reaccelerate
currenttravel
=
math
.
hypot
(
x
-
lastx
,
y
-
lasty
)
if
currenttravel
==
0
and
line
.
e
is
not
None
:
# The following code tries to fix it by forcing a full
# reacceleration if this move is in the opposite direction
# of the previous one
dx
=
x
-
lastx
dy
=
y
-
lasty
if
dx
*
lastdx
+
dy
*
lastdy
<=
0
:
lastf
=
0
currenttravel
=
math
.
hypot
(
dx
,
dy
)
if
currenttravel
==
0
:
if
line
.
z
is
not
None
:
currenttravel
=
abs
(
line
.
z
)
if
line
.
relative
else
abs
(
line
.
z
-
lastz
)
elif
line
.
e
is
not
None
:
currenttravel
=
abs
(
line
.
e
)
if
line
.
relative_e
else
abs
(
line
.
e
-
laste
)
# Feedrate hasn't changed, no acceleration/decceleration planned
if
f
==
lastf
:
...
...
@@ -458,10 +471,14 @@ class GCode(object):
# FIXME: probably a little bit optimistic, but probably a much better estimate than the previous one:
# moveduration = math.sqrt(2 * distance / acceleration) # probably buggy : not taking actual travel into account
lastdx
=
dx
lastdy
=
dy
totalduration
+=
moveduration
lastx
=
x
lasty
=
y
lastz
=
z
laste
=
e
lastf
=
f
...
...
printrun/printrun_utils.py
View file @
d706b876
...
...
@@ -33,7 +33,7 @@ def iconfile(filename):
if
hasattr
(
sys
,
"frozen"
)
and
sys
.
frozen
==
"windows_exe"
:
return
sys
.
executable
else
:
return
pixmapfile
(
"plater.ico"
)
return
pixmapfile
(
filename
)
def
imagefile
(
filename
):
for
prefix
in
[
'/usr/local/share/pronterface/images'
,
...
...
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