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
f69de94a
Commit
f69de94a
authored
Jun 22, 2011
by
kliment
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Real-time print move visualization
parent
52a51fc7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
15 deletions
+32
-15
gviz.py
gviz.py
+20
-8
pronterface.py
pronterface.py
+12
-7
No files found.
gviz.py
View file @
f69de94a
...
...
@@ -24,6 +24,7 @@ class gviz(wx.Panel):
wx
.
Panel
.
__init__
(
self
,
parent
,
-
1
,
size
=
size
)
self
.
bedsize
=
bedsize
self
.
lastpos
=
[
0
,
0
,
0
,
0
,
0
]
self
.
hilightpos
=
self
.
lastpos
[:]
self
.
Bind
(
wx
.
EVT_PAINT
,
self
.
paint
)
self
.
lines
=
{}
self
.
pens
=
{}
...
...
@@ -31,6 +32,7 @@ class gviz(wx.Panel):
self
.
layerindex
=
0
self
.
scale
=
[
min
(
float
(
size
[
0
])
/
bedsize
[
0
],
float
(
size
[
1
])
/
bedsize
[
1
])]
*
2
self
.
mainpen
=
wx
.
Pen
(
wx
.
Colour
(
0
,
0
,
0
))
self
.
hlpen
=
wx
.
Pen
(
wx
.
Colour
(
200
,
50
,
50
))
self
.
fades
=
[
wx
.
Pen
(
wx
.
Colour
(
150
+
20
*
i
,
150
+
20
*
i
,
150
+
20
*
i
))
for
i
in
xrange
(
6
)]
self
.
showall
=
0
self
.
hilight
=
[]
...
...
@@ -81,16 +83,21 @@ class gviz(wx.Panel):
dc
.
DrawLineList
(
l
,
self
.
fades
[
i
])
l
=
map
(
lambda
x
:(
self
.
scale
[
0
]
*
x
[
0
],
self
.
scale
[
1
]
*
x
[
1
],
self
.
scale
[
0
]
*
x
[
2
],
self
.
scale
[
1
]
*
x
[
3
],)
,
self
.
lines
[
self
.
layers
[
self
.
layerindex
]])
dc
.
DrawLineList
(
l
,
self
.
pens
[
self
.
layers
[
self
.
layerindex
]])
l
=
map
(
lambda
x
:(
self
.
scale
[
0
]
*
x
[
0
],
self
.
scale
[
1
]
*
x
[
1
],
self
.
scale
[
0
]
*
x
[
2
],
self
.
scale
[
1
]
*
x
[
3
],)
,
self
.
hilight
)
dc
.
DrawLineList
(
l
,
self
.
hlpen
)
del
dc
def
showall
(
self
,
v
):
self
.
showall
=
v
self
.
Refresh
()
def
addgcode
(
self
,
gcode
=
"M105"
):
def
addgcode
(
self
,
gcode
=
"M105"
,
hilight
=
0
):
gcode
=
gcode
.
split
(
"*"
)[
0
]
if
"g1"
in
gcode
.
lower
():
gcode
=
gcode
.
lower
()
.
split
()
target
=
self
.
lastpos
[:]
if
hilight
:
target
=
self
.
hilightpos
[:]
for
i
in
gcode
:
if
i
[
0
]
==
"x"
:
target
[
0
]
=
float
(
i
[
1
:])
...
...
@@ -103,6 +110,7 @@ class gviz(wx.Panel):
elif
i
[
0
]
==
"f"
:
target
[
4
]
=
float
(
i
[
1
:])
#draw line
if
not
hilight
:
if
not
target
[
2
]
in
self
.
lines
.
keys
():
self
.
lines
[
target
[
2
]]
=
[]
self
.
pens
[
target
[
2
]]
=
[]
...
...
@@ -110,6 +118,10 @@ class gviz(wx.Panel):
self
.
lines
[
target
[
2
]]
+=
[(
self
.
lastpos
[
0
],
self
.
bedsize
[
1
]
-
self
.
lastpos
[
1
],
target
[
0
],
self
.
bedsize
[
1
]
-
target
[
1
])]
self
.
pens
[
target
[
2
]]
+=
[
self
.
mainpen
]
self
.
lastpos
=
target
else
:
self
.
hilight
+=
[(
self
.
hilightpos
[
0
],
self
.
bedsize
[
1
]
-
self
.
hilightpos
[
1
],
target
[
0
],
self
.
bedsize
[
1
]
-
target
[
1
])]
self
.
hilightpos
=
target
if
__name__
==
'__main__'
:
...
...
pronterface.py
View file @
f69de94a
...
...
@@ -95,18 +95,23 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
mini
=
False
self
.
load_rc
(
".pronsolerc"
)
self
.
p
.
sendcb
=
self
.
sentcb
self
.
curlayer
=
0
def
online
(
self
):
print
"Printer is now online"
def
sentcb
(
self
,
line
):
if
(
"Z"
in
line
and
"G1"
in
line
):
if
(
"G1"
in
line
):
if
(
"Z"
in
line
):
try
:
layer
=
float
(
line
.
split
(
"Z"
)[
1
]
.
split
()[
0
])
if
(
layer
!=
self
.
curlayer
):
self
.
curlayer
=
layer
self
.
gviz
.
hilight
=
[]
wx
.
CallAfter
(
self
.
gviz
.
setlayer
,
layer
)
except
:
pass
self
.
gviz
.
addgcode
(
line
,
hilight
=
1
)
def
do_extrude
(
self
,
l
=
""
):
try
:
...
...
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