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
04211253
Commit
04211253
authored
Dec 03, 2011
by
Kliment Yanev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add buggy and slow gcode rendering (hard disabled by default)
parent
344cee84
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
74 deletions
+101
-74
gviz.py
gviz.py
+9
-4
pronterface.py
pronterface.py
+15
-5
stlview.py
stlview.py
+77
-65
No files found.
gviz.py
View file @
04211253
import
wx
,
time
import
wx
,
time
class
window
(
wx
.
Frame
):
class
window
(
wx
.
Frame
):
def
__init__
(
self
,
f
,
size
=
(
600
,
600
),
bedsize
=
(
200
,
200
),
grid
=
(
10
,
50
),
extrusion_width
=
0.5
):
def
__init__
(
self
,
f
,
size
=
(
600
,
600
),
bedsize
=
(
200
,
200
),
grid
=
(
10
,
50
),
extrusion_width
=
0.5
):
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
"
Layer view (Use shift+mousewheel to switch layers)
"
,
size
=
(
size
[
0
],
size
[
1
]))
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
"
Gcode view, shift to move view, mousewheel to set layer
"
,
size
=
(
size
[
0
],
size
[
1
]))
self
.
p
=
gviz
(
self
,
size
=
size
,
bedsize
=
bedsize
,
grid
=
grid
,
extrusion_width
=
extrusion_width
)
self
.
p
=
gviz
(
self
,
size
=
size
,
bedsize
=
bedsize
,
grid
=
grid
,
extrusion_width
=
extrusion_width
)
s
=
time
.
time
()
s
=
time
.
time
()
for
i
in
f
:
self
.
p
.
addgcode
(
i
)
#print time.time()-s
#print time.time()-s
self
.
initpos
=
[
0
,
0
]
self
.
initpos
=
[
0
,
0
]
self
.
p
.
Bind
(
wx
.
EVT_KEY_DOWN
,
self
.
key
)
self
.
p
.
Bind
(
wx
.
EVT_KEY_DOWN
,
self
.
key
)
...
@@ -15,7 +15,7 @@ class window(wx.Frame):
...
@@ -15,7 +15,7 @@ class window(wx.Frame):
self
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
self
.
zoom
)
self
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
self
.
zoom
)
self
.
p
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
mouse
)
self
.
p
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
mouse
)
self
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
mouse
)
self
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
mouse
)
def
mouse
(
self
,
event
):
def
mouse
(
self
,
event
):
if
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
(
self
.
initpos
is
not
None
):
if
(
self
.
initpos
is
not
None
):
...
@@ -213,6 +213,11 @@ class gviz(wx.Panel):
...
@@ -213,6 +213,11 @@ class gviz(wx.Panel):
dc
.
DrawBitmap
(
self
.
blitmap
,
0
,
0
)
dc
.
DrawBitmap
(
self
.
blitmap
,
0
,
0
)
del
dc
del
dc
def
addfile
(
self
,
gcodes
=
[]):
self
.
clear
()
for
i
in
gcodes
:
self
.
addgcode
(
i
)
def
addgcode
(
self
,
gcode
=
"M105"
,
hilight
=
0
):
def
addgcode
(
self
,
gcode
=
"M105"
,
hilight
=
0
):
gcode
=
gcode
.
split
(
"*"
)[
0
]
gcode
=
gcode
.
split
(
"*"
)[
0
]
gcode
=
gcode
.
split
(
";"
)[
0
]
gcode
=
gcode
.
split
(
";"
)[
0
]
...
...
pronterface.py
View file @
04211253
...
@@ -619,6 +619,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -619,6 +619,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
grid
=
(
self
.
settings
.
preview_grid_step1
,
self
.
settings
.
preview_grid_step2
),
grid
=
(
self
.
settings
.
preview_grid_step1
,
self
.
settings
.
preview_grid_step2
),
extrusion_width
=
self
.
settings
.
preview_extrusion_width
)
extrusion_width
=
self
.
settings
.
preview_extrusion_width
)
self
.
gviz
.
showall
=
1
self
.
gviz
.
showall
=
1
#try:
#
# import stlview
# self.gwindow=stlview.GCFrame(None, wx.ID_ANY, 'Gcode view, shift to move view, mousewheel to set layer', size=(600,600))
#except:
self
.
gwindow
=
gviz
.
window
([],
self
.
gwindow
=
gviz
.
window
([],
bedsize
=
(
self
.
settings
.
bed_size_x
,
self
.
settings
.
bed_size_y
),
bedsize
=
(
self
.
settings
.
bed_size_x
,
self
.
settings
.
bed_size_y
),
grid
=
(
self
.
settings
.
preview_grid_step1
,
self
.
settings
.
preview_grid_step2
),
grid
=
(
self
.
settings
.
preview_grid_step1
,
self
.
settings
.
preview_grid_step2
),
...
@@ -658,6 +663,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -658,6 +663,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
#self.panel.Fit()
#self.panel.Fit()
#uts.Layout()
#uts.Layout()
self
.
cbuttons_reload
()
self
.
cbuttons_reload
()
def
plate
(
self
,
e
):
def
plate
(
self
,
e
):
import
plater
import
plater
...
@@ -689,8 +695,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -689,8 +695,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def
showwin
(
self
,
event
):
def
showwin
(
self
,
event
):
if
(
self
.
f
is
not
None
):
if
(
self
.
f
is
not
None
):
self
.
gwindow
.
Show
()
self
.
gwindow
.
Show
(
True
)
def
setfeeds
(
self
,
e
):
def
setfeeds
(
self
,
e
):
self
.
feedrates_changed
=
True
self
.
feedrates_changed
=
True
try
:
try
:
...
@@ -1347,11 +1353,15 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1347,11 +1353,15 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
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
)
print
_
(
"Estimated duration (pessimistic): "
),
pronsole
.
estimate_duration
(
self
.
f
)
#import time
#t0=time.time()
self
.
gviz
.
clear
()
self
.
gviz
.
clear
()
self
.
gwindow
.
p
.
clear
()
self
.
gwindow
.
p
.
clear
()
for
i
in
self
.
f
:
self
.
gviz
.
addfile
(
self
.
f
)
self
.
gviz
.
addgcode
(
i
)
#print "generated 2d view in %f s"%(time.time()-t0)
self
.
gwindow
.
p
.
addgcode
(
i
)
#t0=time.time()
self
.
gwindow
.
p
.
addfile
(
self
.
f
)
#print "generated 3d view in %f s"%(time.time()-t0)
self
.
gviz
.
showall
=
1
self
.
gviz
.
showall
=
1
wx
.
CallAfter
(
self
.
gviz
.
Refresh
)
wx
.
CallAfter
(
self
.
gviz
.
Refresh
)
...
...
stlview.py
View file @
04211253
...
@@ -212,6 +212,10 @@ class stlview(object):
...
@@ -212,6 +212,10 @@ class stlview(object):
def
delete
(
self
):
def
delete
(
self
):
self
.
vertex_list
.
delete
()
self
.
vertex_list
.
delete
()
def
vdiff
(
v
,
o
):
return
[
x
[
0
]
-
x
[
1
]
for
x
in
zip
(
v
,
o
)]
class
gcview
(
object
):
class
gcview
(
object
):
def
__init__
(
self
,
lines
,
batch
,
w
=
0.5
,
h
=
0.5
):
def
__init__
(
self
,
lines
,
batch
,
w
=
0.5
,
h
=
0.5
):
# Create the vertex and normal arrays.
# Create the vertex and normal arrays.
...
@@ -219,25 +223,25 @@ class gcview(object):
...
@@ -219,25 +223,25 @@ class gcview(object):
normals
=
[]
normals
=
[]
self
.
prev
=
[
0.001
,
0.001
,
0.001
,
0.001
]
self
.
prev
=
[
0.001
,
0.001
,
0.001
,
0.001
]
self
.
fline
=
1
self
.
fline
=
1
f
=
open
(
"20cube_export.gcode"
)
lines
=
list
(
f
)
f
.
close
()
self
.
vlists
=
[]
self
.
vlists
=
[]
self
.
layers
=
{}
self
.
layers
=
{}
t0
=
time
.
time
()
lines
=
[
self
.
transform
(
i
)
for
i
in
lines
]
lines
=
[
self
.
transform
(
i
)
for
i
in
lines
]
lines
=
[
i
for
i
in
lines
if
i
is
not
None
]
lines
=
[
i
for
i
in
lines
if
i
is
not
None
]
print
"transformed lines in
%
fs"
%
(
time
.
time
()
-
t0
)
t0
=
time
.
time
()
layertemp
=
{}
layertemp
=
{}
lasth
=
None
lasth
=
None
counter
=
0
if
len
(
lines
)
==
0
:
return
for
i
in
lines
:
for
i
in
lines
:
counter
+=
1
if
i
[
0
][
2
]
not
in
layertemp
:
if
i
[
0
][
2
]
not
in
layertemp
:
layertemp
[
i
[
0
][
2
]]
=
[[],[]]
layertemp
[
i
[
0
][
2
]]
=
[[],[]]
if
lasth
is
not
None
:
if
lasth
is
not
None
:
self
.
layers
[
lasth
]
=
pyglet
.
graphics
.
Batch
()
self
.
layers
[
lasth
]
=
pyglet
.
graphics
.
Batch
()
lt
=
layertemp
[
lasth
][
0
]
lt
=
layertemp
[
lasth
][
0
]
#for p in [[lt[k:k+3],lt[k+3:k+6],lt[k+6:k+9]] for k in range(0, len(lt), 9)]:
# area= 0.5*math.sqrt(sum(map(lambda x:x*x,stltool.cross(vdiff(p[1],p[0]),vdiff(p[2],p[0])))))
# if area>3: print p,area
#print len(lt),lasth
indices
=
range
(
len
(
layertemp
[
lasth
][
0
])
//
3
)
#[[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
indices
=
range
(
len
(
layertemp
[
lasth
][
0
])
//
3
)
#[[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
self
.
vlists
.
append
(
self
.
layers
[
lasth
]
.
add_indexed
(
len
(
layertemp
[
lasth
][
0
])
//
3
,
self
.
vlists
.
append
(
self
.
layers
[
lasth
]
.
add_indexed
(
len
(
layertemp
[
lasth
][
0
])
//
3
,
GL_TRIANGLES
,
GL_TRIANGLES
,
...
@@ -247,45 +251,29 @@ class gcview(object):
...
@@ -247,45 +251,29 @@ class gcview(object):
(
'n3f/static'
,
layertemp
[
lasth
][
1
])))
(
'n3f/static'
,
layertemp
[
lasth
][
1
])))
lasth
=
i
[
0
][
2
]
lasth
=
i
[
0
][
2
]
#if lasth==3.8:
# return
def
vdiff
(
v
,
o
):
return
map
(
lambda
x
,
y
:
x
-
y
,
v
,
o
)
spoints
,
epoints
,
S
,
E
=
self
.
genline
(
i
,
h
,
w
)
#if abs(sum(vdiff(S,E)))<10:
# continue
# print spoints
for
j
in
xrange
(
8
):
layertemp
[
i
[
0
][
2
]][
0
]
.
extend
(
spoints
[(
j
+
1
)
%
8
])
layertemp
[
i
[
0
][
2
]][
1
]
.
extend
(
vdiff
(
spoints
[(
j
+
1
)
%
8
],
S
))
layertemp
[
i
[
0
][
2
]][
0
]
.
extend
(
epoints
[(
j
)
%
8
])
layertemp
[
i
[
0
][
2
]][
1
]
.
extend
(
vdiff
(
epoints
[(
j
)
%
8
],
E
))
layertemp
[
i
[
0
][
2
]][
0
]
.
extend
(
spoints
[
j
])
layertemp
[
i
[
0
][
2
]][
1
]
.
extend
(
vdiff
(
spoints
[
j
],
S
))
layertemp
[
i
[
0
][
2
]][
0
]
.
extend
(
epoints
[(
j
)])
layertemp
[
i
[
0
][
2
]][
1
]
.
extend
(
vdiff
(
epoints
[(
j
)],
E
))
layertemp
[
i
[
0
][
2
]][
0
]
.
extend
(
spoints
[(
j
+
1
)
%
8
])
layertemp
[
i
[
0
][
2
]][
1
]
.
extend
(
vdiff
(
spoints
[
j
],
S
))
layertemp
[
i
[
0
][
2
]][
0
]
.
extend
(
epoints
[(
j
+
1
)
%
8
])
layertemp
[
i
[
0
][
2
]][
1
]
.
extend
(
vdiff
(
epoints
[(
j
+
1
)
%
8
],
E
))
vertices
.
extend
(
spoints
[(
j
+
1
)
%
8
])
spoints
,
epoints
,
S
,
E
=
self
.
genline
(
i
,
h
,
w
)
normals
.
extend
(
vdiff
(
spoints
[(
j
+
1
)
%
8
],
S
))
vertices
.
extend
(
epoints
[(
j
)
%
8
])
verticestoadd
=
[[
spoints
[(
j
+
1
)
%
8
],
epoints
[(
j
)
%
8
],
spoints
[
j
],
epoints
[
j
],
spoints
[(
j
+
1
)
%
8
],
epoints
[(
j
+
1
)
%
8
]]
for
j
in
xrange
(
8
)]
normals
.
extend
(
vdiff
(
epoints
[(
j
)
%
8
],
E
))
normalstoadd
=
[
map
(
vdiff
,
v
,[
S
,
E
,
S
,
E
,
S
,
E
])
for
v
in
verticestoadd
]
vertices
.
extend
(
spoints
[
j
])
v1
=
[]
normals
.
extend
(
vdiff
(
spoints
[
j
],
S
))
map
(
v1
.
extend
,
verticestoadd
)
vertices
.
extend
(
epoints
[(
j
)])
v2
=
[]
normals
.
extend
(
vdiff
(
epoints
[(
j
)],
E
))
map
(
v2
.
extend
,
v1
)
vertices
.
extend
(
spoints
[(
j
+
1
)
%
8
])
n1
=
[]
normals
.
extend
(
vdiff
(
spoints
[
j
],
S
))
map
(
n1
.
extend
,
normalstoadd
)
vertices
.
extend
(
epoints
[(
j
+
1
)
%
8
])
n2
=
[]
normals
.
extend
(
vdiff
(
epoints
[(
j
+
1
)
%
8
],
E
))
map
(
n2
.
extend
,
n1
)
layertemp
[
i
[
0
][
2
]][
0
]
+=
v2
vertices
+=
v2
layertemp
[
i
[
0
][
2
]][
1
]
+=
n2
normals
+=
n2
print
"appended lines in
%
fs"
%
(
time
.
time
()
-
t0
)
t0
=
time
.
time
()
# Create a list of triangle indices.
# Create a list of triangle indices.
indices
=
range
(
3
*
16
*
len
(
lines
))
#[[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
indices
=
range
(
3
*
16
*
len
(
lines
))
#[[3*i,3*i+1,3*i+2] for i in xrange(len(facets))]
#print indices[:10]
self
.
vlists
.
append
(
batch
.
add_indexed
(
len
(
vertices
)
//
3
,
self
.
vlists
.
append
(
batch
.
add_indexed
(
len
(
vertices
)
//
3
,
GL_TRIANGLES
,
GL_TRIANGLES
,
None
,
#group,
None
,
#group,
...
@@ -338,7 +326,7 @@ class gcview(object):
...
@@ -338,7 +326,7 @@ class gcview(object):
points
=
map
(
lambda
x
:[
x
[
0
],
x
[
1
],
htw
*
x
[
2
]],
points
)
points
=
map
(
lambda
x
:[
x
[
0
],
x
[
1
],
htw
*
x
[
2
]],
points
)
def
vadd
(
v
,
o
):
def
vadd
(
v
,
o
):
return
map
(
lambda
x
,
y
:
x
+
y
,
v
,
o
)
return
map
(
sum
,
zip
(
v
,
o
)
)
spoints
=
map
(
lambda
x
:
vadd
(
S
,
x
),
points
)
spoints
=
map
(
lambda
x
:
vadd
(
S
,
x
),
points
)
epoints
=
map
(
lambda
x
:
vadd
(
E
,
x
),
points
)
epoints
=
map
(
lambda
x
:
vadd
(
E
,
x
),
points
)
return
spoints
,
epoints
,
S
,
E
return
spoints
,
epoints
,
S
,
E
...
@@ -567,6 +555,10 @@ class TestGlPanel(GLPanel):
...
@@ -567,6 +555,10 @@ class TestGlPanel(GLPanel):
i
=
self
.
parent
.
l
.
GetSelection
()
i
=
self
.
parent
.
l
.
GetSelection
()
if
i
<
0
:
if
i
<
0
:
try
:
self
.
parent
.
setlayerindex
(
z
)
except
:
pass
return
return
m
=
self
.
parent
.
models
[
self
.
parent
.
l
.
GetString
(
i
)]
m
=
self
.
parent
.
models
[
self
.
parent
.
l
.
GetString
(
i
)]
...
@@ -731,49 +723,69 @@ class TestGlPanel(GLPanel):
...
@@ -731,49 +723,69 @@ class TestGlPanel(GLPanel):
glPopMatrix
()
glPopMatrix
()
glPopMatrix
()
glPopMatrix
()
#print "drawn batch"
#print "drawn batch"
class
Test
Frame
(
wx
.
Frame
):
class
GC
Frame
(
wx
.
Frame
):
'''A simple class for using OpenGL with wxPython.'''
'''A simple class for using OpenGL with wxPython.'''
def
__init__
(
self
,
parent
,
ID
,
title
,
pos
=
wx
.
DefaultPosition
,
def
__init__
(
self
,
parent
,
ID
,
title
,
pos
=
wx
.
DefaultPosition
,
size
=
wx
.
DefaultSize
,
style
=
wx
.
DEFAULT_FRAME_STYLE
):
size
=
wx
.
DefaultSize
,
style
=
wx
.
DEFAULT_FRAME_STYLE
):
super
(
TestFrame
,
self
)
.
__init__
(
parent
,
ID
,
title
,
pos
,
(
size
[
0
]
+
150
,
size
[
1
]),
style
)
super
(
GCFrame
,
self
)
.
__init__
(
parent
,
ID
,
title
,
pos
,
(
size
[
0
]
+
150
,
size
[
1
]),
style
)
self
.
mainsizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
panel
=
wx
.
Panel
(
self
,
-
1
,
size
=
(
150
,
600
),
pos
=
(
0
,
0
))
self
.
panel
.
SetBackgroundColour
((
10
,
10
,
10
))
self
.
SetBackgroundColour
((
10
,
10
,
10
))
self
.
mainsizer
.
Add
(
self
.
panel
)
#self.mainsizer.AddSpacer(10)
class
d
:
class
d
:
def
GetSelection
(
self
):
def
GetSelection
(
self
):
return
-
1
return
-
1
self
.
p
=
self
m
=
d
()
m
=
d
()
m
.
offsets
=
[
0
,
0
,
0
]
m
.
offsets
=
[
0
,
0
,
0
]
m
.
rot
=
0
m
.
rot
=
0
m
.
curlayer
=
7
.0
m
.
curlayer
=
0
.0
m
.
scale
=
[
1.
,
1.
,
1.
]
m
.
scale
=
[
1.
,
1.
,
1.
]
m
.
batch
=
pyglet
.
graphics
.
Batch
()
m
.
batch
=
pyglet
.
graphics
.
Batch
()
m
.
gc
=
gcview
([],
batch
=
m
.
batch
)
m
.
gc
=
gcview
([],
batch
=
m
.
batch
)
self
.
models
=
{
""
:
m
}
self
.
models
=
{
""
:
m
}
self
.
l
=
d
()
self
.
l
=
d
()
self
.
modelindex
=
0
self
.
GLPanel1
=
TestGlPanel
(
self
,
size
)
self
.
GLPanel1
=
TestGlPanel
(
self
,
size
)
self
.
mainsizer
.
Add
(
self
.
GLPanel1
,
1
,
wx
.
EXPAND
)
#self.GLPanel2 = TestGlPanel(self, wx.ID_ANY, (20, 20))
def
addfile
(
self
,
gcode
=
[]):
#self.mainsizer.Add(self.GLPanel2, 1, wx.EXPAND)
self
.
models
[
""
]
.
gc
.
delete
()
self
.
SetSizer
(
self
.
mainsizer
)
self
.
models
[
""
]
.
gc
=
gcview
(
gcode
,
batch
=
self
.
models
[
""
]
.
batch
)
#self.mainsizer.Fit(self)
self
.
Layout
()
def
clear
(
self
):
self
.
models
[
""
]
.
gc
.
delete
()
self
.
models
[
""
]
.
gc
=
gcview
([],
batch
=
self
.
models
[
""
]
.
batch
)
def
Show
(
self
,
arg
=
True
):
wx
.
Frame
.
Show
(
self
,
arg
)
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
+
1
))
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
-
1
))
self
.
Refresh
()
wx
.
FutureCall
(
500
,
self
.
GLPanel1
.
forceresize
)
#threading.Thread(target=self.update).start()
#self.initialized=0
def
setlayerindex
(
self
,
z
):
m
=
self
.
models
[
""
]
mlk
=
sorted
(
m
.
gc
.
layers
.
keys
())
if
z
>
0
and
self
.
modelindex
<
len
(
mlk
)
-
1
:
self
.
modelindex
+=
1
if
z
<
0
and
self
.
modelindex
>
0
:
self
.
modelindex
-=
1
m
.
curlayer
=
mlk
[
self
.
modelindex
]
wx
.
CallAfter
(
self
.
SetTitle
,
"Gcode view, shift to move. Layer
%
d, Z=
%
f"
%
(
self
.
modelindex
,
m
.
curlayer
))
if
__name__
==
"__main__"
:
rx
=
ry
=
rz
=
0
def
main
():
app
=
wx
.
App
(
redirect
=
False
)
app
=
wx
.
App
(
redirect
=
False
)
frame
=
TestFrame
(
None
,
wx
.
ID_ANY
,
'GL Window'
,
size
=
(
400
,
400
))
frame
=
GCFrame
(
None
,
wx
.
ID_ANY
,
'Gcode view, shift to move view, mousewheel to set layer'
,
size
=
(
400
,
400
))
frame
.
addfile
(
list
(
open
(
"carriage dump_export.gcode"
)))
#frame = wx.Frame(None, -1, "GL Window", size=(400,400))
#frame = wx.Frame(None, -1, "GL Window", size=(400,400))
#panel = TestGlPanel(frame)
#panel = TestGlPanel(frame)
frame
.
Show
(
True
)
#
frame.Show(True)
app
.
MainLoop
()
#
app.MainLoop()
app
.
Destroy
()
app
.
Destroy
()
if
__name__
==
"__main__"
:
import
cProfile
print
cProfile
.
run
(
"main()"
)
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