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
Show 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
import
wx
,
time
class
window
(
wx
.
Frame
):
class
window
(
wx
.
Frame
):
def
__init__
(
self
):
def
__init__
(
self
,
f
,
size
=
(
600
,
600
),
bedsize
=
(
200
,
200
)
):
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
"Slicetest"
,
size
=
(
600
,
600
))
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
"Slicetest"
,
size
=
(
size
[
0
],
size
[
1
]
))
self
.
p
=
gviz
(
self
,
size
=
(
600
,
600
),
bedsize
=
(
200
,
200
)
)
self
.
p
=
gviz
(
self
,
size
=
size
,
bedsize
=
bedsize
)
s
=
time
.
time
()
s
=
time
.
time
()
for
i
in
open
(
"/home/kliment/designs/spinner/gearend_export.gcode"
)
:
for
i
in
f
:
self
.
p
.
addgcode
(
i
)
self
.
p
.
addgcode
(
i
)
print
time
.
time
()
-
s
#
print time.time()-s
self
.
p
.
Bind
(
wx
.
EVT_KEY_DOWN
,
self
.
key
)
self
.
p
.
Bind
(
wx
.
EVT_KEY_DOWN
,
self
.
key
)
def
key
(
self
,
event
):
def
key
(
self
,
event
):
x
=
event
.
GetKeyCode
()
x
=
event
.
GetKeyCode
()
...
@@ -21,7 +21,8 @@ class window(wx.Frame):
...
@@ -21,7 +21,8 @@ class window(wx.Frame):
class
gviz
(
wx
.
Panel
):
class
gviz
(
wx
.
Panel
):
def
__init__
(
self
,
parent
,
size
=
(
200
,
200
),
bedsize
=
(
200
,
200
)):
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
.
bedsize
=
bedsize
self
.
lastpos
=
[
0
,
0
,
0
,
0
,
0
]
self
.
lastpos
=
[
0
,
0
,
0
,
0
,
0
]
self
.
hilightpos
=
self
.
lastpos
[:]
self
.
hilightpos
=
self
.
lastpos
[:]
...
@@ -69,6 +70,11 @@ class gviz(wx.Panel):
...
@@ -69,6 +70,11 @@ class gviz(wx.Panel):
dc
=
wx
.
PaintDC
(
self
)
dc
=
wx
.
PaintDC
(
self
)
dc
.
SetBackground
(
wx
.
Brush
((
250
,
250
,
200
)))
dc
.
SetBackground
(
wx
.
Brush
((
250
,
250
,
200
)))
dc
.
Clear
()
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
:
if
self
.
showall
:
l
=
[]
l
=
[]
for
i
in
self
.
layers
:
for
i
in
self
.
layers
:
...
@@ -87,10 +93,6 @@ class gviz(wx.Panel):
...
@@ -87,10 +93,6 @@ class gviz(wx.Panel):
dc
.
DrawLineList
(
l
,
self
.
hlpen
)
dc
.
DrawLineList
(
l
,
self
.
hlpen
)
del
dc
del
dc
def
showall
(
self
,
v
):
self
.
showall
=
v
self
.
Refresh
()
def
addgcode
(
self
,
gcode
=
"M105"
,
hilight
=
0
):
def
addgcode
(
self
,
gcode
=
"M105"
,
hilight
=
0
):
gcode
=
gcode
.
split
(
"*"
)[
0
]
gcode
=
gcode
.
split
(
"*"
)[
0
]
if
"g1"
in
gcode
.
lower
():
if
"g1"
in
gcode
.
lower
():
...
@@ -126,7 +128,7 @@ class gviz(wx.Panel):
...
@@ -126,7 +128,7 @@ class gviz(wx.Panel):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
app
=
wx
.
App
(
False
)
app
=
wx
.
App
(
False
)
main
=
window
()
main
=
window
(
open
(
"/home/kliment/designs/spinner/gearend_export.gcode"
)
)
main
.
Show
()
main
.
Show
()
app
.
MainLoop
()
app
.
MainLoop
()
pronterface.py
View file @
48b981f2
...
@@ -7,16 +7,12 @@ except:
...
@@ -7,16 +7,12 @@ except:
import
printcore
,
os
,
sys
,
glob
,
time
,
threading
,
traceback
,
StringIO
,
gviz
import
printcore
,
os
,
sys
,
glob
,
time
,
threading
,
traceback
,
StringIO
,
gviz
thread
=
threading
.
Thread
thread
=
threading
.
Thread
winsize
=
(
800
,
500
)
winsize
=
(
800
,
500
)
winssize
=
(
800
,
120
)
if
os
.
name
==
"nt"
:
if
os
.
name
==
"nt"
:
winsize
=
(
800
,
530
)
winsize
=
(
800
,
530
)
winssize
=
(
800
,
140
)
try
:
try
:
import
_winreg
import
_winreg
except
:
except
:
pass
pass
if
sys
.
platform
==
"darwin"
:
winssize
=
(
800
,
110
)
import
pronsole
import
pronsole
...
@@ -112,6 +108,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -112,6 +108,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
except
:
except
:
pass
pass
self
.
gviz
.
addgcode
(
line
,
hilight
=
1
)
self
.
gviz
.
addgcode
(
line
,
hilight
=
1
)
self
.
gwindow
.
p
.
addgcode
(
line
,
hilight
=
1
)
def
do_extrude
(
self
,
l
=
""
):
def
do_extrude
(
self
,
l
=
""
):
try
:
try
:
...
@@ -333,6 +330,9 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -333,6 +330,9 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
zfeedc
.
SetForegroundColour
(
"black"
)
self
.
zfeedc
.
SetForegroundColour
(
"black"
)
lls
.
Add
((
10
,
0
),
pos
=
(
0
,
11
),
span
=
(
1
,
1
))
lls
.
Add
((
10
,
0
),
pos
=
(
0
,
11
),
span
=
(
1
,
1
))
self
.
gviz
=
gviz
.
gviz
(
self
.
panel
,(
200
,
200
),(
200
,
200
))
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
))
lls
.
Add
(
self
.
gviz
,
pos
=
(
0
,
10
),
span
=
(
9
,
1
))
self
.
uppersizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
uppersizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
...
@@ -355,8 +355,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -355,8 +355,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
#self.panel.Fit()
#self.panel.Fit()
#uts.Layout()
#uts.Layout()
def
showwin
(
self
,
event
):
pass
self
.
gwindow
.
Show
()
def
setfeeds
(
self
,
e
):
def
setfeeds
(
self
,
e
):
try
:
try
:
...
@@ -400,6 +400,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -400,6 +400,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
statuscheck
=
0
self
.
statuscheck
=
0
self
.
p
.
recvcb
=
None
self
.
p
.
recvcb
=
None
self
.
p
.
disconnect
()
self
.
p
.
disconnect
()
try
:
self
.
gwindow
.
Destroy
()
except
:
pass
self
.
Destroy
()
self
.
Destroy
()
...
@@ -595,6 +599,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -595,6 +599,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
gviz
.
clear
()
self
.
gviz
.
clear
()
for
i
in
self
.
f
:
for
i
in
self
.
f
:
self
.
gviz
.
addgcode
(
i
)
self
.
gviz
.
addgcode
(
i
)
self
.
gwindow
.
p
.
addgcode
(
i
)
self
.
gviz
.
showall
=
1
self
.
gviz
.
showall
=
1
wx
.
CallAfter
(
self
.
gviz
.
Refresh
)
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