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
48b981f2
Commit
48b981f2
authored
Jun 22, 2011
by
kliment
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bigger gcode visualization window on click, layer progress bar
parent
f69de94a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
17 deletions
+24
-17
gviz.py
gviz.py
+13
-11
pronterface.py
pronterface.py
+11
-6
No files found.
gviz.py
View file @
48b981f2
import
wx
,
time
class
window
(
wx
.
Frame
):
def
__init__
(
self
):
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
"Slicetest"
,
size
=
(
600
,
600
))
self
.
p
=
gviz
(
self
,
size
=
(
600
,
600
),
bedsize
=
(
200
,
200
)
)
def
__init__
(
self
,
f
,
size
=
(
600
,
600
),
bedsize
=
(
200
,
200
)
):
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
"Slicetest"
,
size
=
(
size
[
0
],
size
[
1
]
))
self
.
p
=
gviz
(
self
,
size
=
size
,
bedsize
=
bedsize
)
s
=
time
.
time
()
for
i
in
open
(
"/home/kliment/designs/spinner/gearend_export.gcode"
)
:
for
i
in
f
:
self
.
p
.
addgcode
(
i
)
print
time
.
time
()
-
s
#
print time.time()-s
self
.
p
.
Bind
(
wx
.
EVT_KEY_DOWN
,
self
.
key
)
def
key
(
self
,
event
):
x
=
event
.
GetKeyCode
()
...
...
@@ -21,7 +21,8 @@ class window(wx.Frame):
class
gviz
(
wx
.
Panel
):
def
__init__
(
self
,
parent
,
size
=
(
200
,
200
),
bedsize
=
(
200
,
200
)):
wx
.
Panel
.
__init__
(
self
,
parent
,
-
1
,
size
=
size
)
wx
.
Panel
.
__init__
(
self
,
parent
,
-
1
,
size
=
(
size
[
0
],
size
[
1
]))
self
.
size
=
size
self
.
bedsize
=
bedsize
self
.
lastpos
=
[
0
,
0
,
0
,
0
,
0
]
self
.
hilightpos
=
self
.
lastpos
[:]
...
...
@@ -69,6 +70,11 @@ class gviz(wx.Panel):
dc
=
wx
.
PaintDC
(
self
)
dc
.
SetBackground
(
wx
.
Brush
((
250
,
250
,
200
)))
dc
.
Clear
()
dc
.
SetBrush
(
wx
.
Brush
((
0
,
0
,
0
)))
dc
.
DrawRectangle
(
self
.
size
[
0
]
-
15
,
0
,
15
,
self
.
size
[
1
])
dc
.
SetBrush
(
wx
.
Brush
((
0
,
255
,
0
)))
if
len
(
self
.
layers
):
dc
.
DrawRectangle
(
self
.
size
[
0
]
-
14
,(
1.0
-
(
1.0
*
self
.
layerindex
)
/
len
(
self
.
layers
))
*
self
.
size
[
1
],
13
,
self
.
size
[
1
]
-
1
)
if
self
.
showall
:
l
=
[]
for
i
in
self
.
layers
:
...
...
@@ -87,10 +93,6 @@ class gviz(wx.Panel):
dc
.
DrawLineList
(
l
,
self
.
hlpen
)
del
dc
def
showall
(
self
,
v
):
self
.
showall
=
v
self
.
Refresh
()
def
addgcode
(
self
,
gcode
=
"M105"
,
hilight
=
0
):
gcode
=
gcode
.
split
(
"*"
)[
0
]
if
"g1"
in
gcode
.
lower
():
...
...
@@ -126,7 +128,7 @@ class gviz(wx.Panel):
if
__name__
==
'__main__'
:
app
=
wx
.
App
(
False
)
main
=
window
()
main
=
window
(
open
(
"/home/kliment/designs/spinner/gearend_export.gcode"
)
)
main
.
Show
()
app
.
MainLoop
()
pronterface.py
View file @
48b981f2
...
...
@@ -7,16 +7,12 @@ except:
import
printcore
,
os
,
sys
,
glob
,
time
,
threading
,
traceback
,
StringIO
,
gviz
thread
=
threading
.
Thread
winsize
=
(
800
,
500
)
winssize
=
(
800
,
120
)
if
os
.
name
==
"nt"
:
winsize
=
(
800
,
530
)
winssize
=
(
800
,
140
)
try
:
import
_winreg
except
:
pass
if
sys
.
platform
==
"darwin"
:
winssize
=
(
800
,
110
)
import
pronsole
...
...
@@ -112,6 +108,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
except
:
pass
self
.
gviz
.
addgcode
(
line
,
hilight
=
1
)
self
.
gwindow
.
p
.
addgcode
(
line
,
hilight
=
1
)
def
do_extrude
(
self
,
l
=
""
):
try
:
...
...
@@ -333,6 +330,9 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
zfeedc
.
SetForegroundColour
(
"black"
)
lls
.
Add
((
10
,
0
),
pos
=
(
0
,
11
),
span
=
(
1
,
1
))
self
.
gviz
=
gviz
.
gviz
(
self
.
panel
,(
200
,
200
),(
200
,
200
))
self
.
gwindow
=
gviz
.
window
([])
self
.
gviz
.
Bind
(
wx
.
EVT_LEFT_DOWN
,
self
.
showwin
)
self
.
gwindow
.
Bind
(
wx
.
EVT_CLOSE
,
lambda
x
:
self
.
gwindow
.
Hide
())
lls
.
Add
(
self
.
gviz
,
pos
=
(
0
,
10
),
span
=
(
9
,
1
))
self
.
uppersizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
...
...
@@ -355,8 +355,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
#self.panel.Fit()
#uts.Layout()
pass
def
showwin
(
self
,
event
):
self
.
gwindow
.
Show
()
def
setfeeds
(
self
,
e
):
try
:
...
...
@@ -400,6 +400,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
statuscheck
=
0
self
.
p
.
recvcb
=
None
self
.
p
.
disconnect
()
try
:
self
.
gwindow
.
Destroy
()
except
:
pass
self
.
Destroy
()
...
...
@@ -595,6 +599,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
gviz
.
clear
()
for
i
in
self
.
f
:
self
.
gviz
.
addgcode
(
i
)
self
.
gwindow
.
p
.
addgcode
(
i
)
self
.
gviz
.
showall
=
1
wx
.
CallAfter
(
self
.
gviz
.
Refresh
)
...
...
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