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
62e31e73
Commit
62e31e73
authored
Oct 15, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refresh 2D view every 0.2s during viz loading
parent
e2b25795
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
gviz.py
printrun/gviz.py
+15
-4
No files found.
printrun/gviz.py
View file @
62e31e73
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
from
Queue
import
Queue
from
Queue
import
Queue
from
collections
import
deque
from
collections
import
deque
import
wx
import
wx
import
time
from
printrun
import
gcoder
from
printrun
import
gcoder
from
printrun_utils
import
imagefile
,
install_locale
from
printrun_utils
import
imagefile
,
install_locale
...
@@ -380,8 +381,9 @@ class Gviz(wx.Panel):
...
@@ -380,8 +381,9 @@ class Gviz(wx.Panel):
if
self
.
paint_overlay
:
if
self
.
paint_overlay
:
self
.
paint_overlay
(
dc
)
self
.
paint_overlay
(
dc
)
def
addfile
(
self
,
gcode
):
def
addfile
(
self
,
gcode
,
showall
=
False
):
self
.
clear
()
self
.
clear
()
self
.
showall
=
showall
self
.
add_parsed_gcodes
(
gcode
)
self
.
add_parsed_gcodes
(
gcode
)
max_layers
=
len
(
self
.
layers
)
max_layers
=
len
(
self
.
layers
)
if
hasattr
(
self
.
parent
,
"layerslider"
):
if
hasattr
(
self
.
parent
,
"layerslider"
):
...
@@ -399,6 +401,8 @@ class Gviz(wx.Panel):
...
@@ -399,6 +401,8 @@ class Gviz(wx.Panel):
def
_x
(
x
):
def
_x
(
x
):
return
x
-
self
.
build_dimensions
[
3
]
return
x
-
self
.
build_dimensions
[
3
]
start_time
=
time
.
time
()
for
layer_idx
,
layer
in
enumerate
(
gcode
.
all_layers
):
for
layer_idx
,
layer
in
enumerate
(
gcode
.
all_layers
):
has_move
=
False
has_move
=
False
for
gline
in
layer
:
for
gline
in
layer
:
...
@@ -411,7 +415,6 @@ class Gviz(wx.Panel):
...
@@ -411,7 +415,6 @@ class Gviz(wx.Panel):
self
.
pens
[
layer
.
z
]
=
[]
self
.
pens
[
layer
.
z
]
=
[]
self
.
arcs
[
layer
.
z
]
=
[]
self
.
arcs
[
layer
.
z
]
=
[]
self
.
arcpens
[
layer
.
z
]
=
[]
self
.
arcpens
[
layer
.
z
]
=
[]
self
.
layers
.
append
(
layer
.
z
)
for
gline
in
layer
:
for
gline
in
layer
:
if
not
gline
.
is_move
:
if
not
gline
.
is_move
:
continue
continue
...
@@ -448,8 +451,16 @@ class Gviz(wx.Panel):
...
@@ -448,8 +451,16 @@ class Gviz(wx.Panel):
self
.
arcpens
[
layer
.
z
]
.
append
(
self
.
arcpen
)
self
.
arcpens
[
layer
.
z
]
.
append
(
self
.
arcpen
)
self
.
lastpos
=
target
self
.
lastpos
=
target
# Only add layer.z to self.layers now to prevent the display of an
# unfinished layer
self
.
layers
.
append
(
layer
.
z
)
# Refresh display if more than 0.2s have passed
if
time
.
time
()
-
start_time
>
0.2
:
start_time
=
time
.
time
()
self
.
dirty
=
1
wx
.
CallAfter
(
self
.
Refresh
)
self
.
dirty
=
1
self
.
dirty
=
1
self
.
Refresh
(
)
wx
.
CallAfter
(
self
.
Refresh
)
def
addgcode
(
self
,
gcode
=
"M105"
,
hilight
=
0
):
def
addgcode
(
self
,
gcode
=
"M105"
,
hilight
=
0
):
gcode
=
gcode
.
split
(
"*"
)[
0
]
gcode
=
gcode
.
split
(
"*"
)[
0
]
...
@@ -519,7 +530,7 @@ class Gviz(wx.Panel):
...
@@ -519,7 +530,7 @@ class Gviz(wx.Panel):
self
.
dirty
=
1
self
.
dirty
=
1
else
:
else
:
self
.
hilightpos
=
target
self
.
hilightpos
=
target
self
.
Refresh
(
)
wx
.
CallAfter
(
self
.
Refresh
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
sys
import
sys
...
...
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