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
5d4aad0c
Commit
5d4aad0c
authored
Dec 11, 2011
by
Clarence Risher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all dimensions in one string
parent
5b4b84d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
20 deletions
+48
-20
gviz.py
gviz.py
+11
-12
pronterface.py
pronterface.py
+37
-8
No files found.
gviz.py
View file @
5d4aad0c
import
wx
,
time
import
wx
,
time
class
window
(
wx
.
Frame
):
class
window
(
wx
.
Frame
):
def
__init__
(
self
,
f
,
size
=
(
600
,
600
),
b
edsize
=
(
200
,
200
),
center
=
(
100
,
100
)
,
grid
=
(
10
,
50
),
extrusion_width
=
0.5
):
def
__init__
(
self
,
f
,
size
=
(
600
,
600
),
b
uild_dimensions
=
[
200
,
200
,
100
,
0
,
0
,
0
]
,
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
=
"Layer view (Use shift+mousewheel to switch layers)"
,
size
=
(
size
[
0
],
size
[
1
]))
self
.
p
=
gviz
(
self
,
size
=
size
,
b
edsize
=
bedsize
,
center
=
center
,
grid
=
grid
,
extrusion_width
=
extrusion_width
)
self
.
p
=
gviz
(
self
,
size
=
size
,
b
uild_dimensions
=
build_dimensions
,
grid
=
grid
,
extrusion_width
=
extrusion_width
)
s
=
time
.
time
()
s
=
time
.
time
()
for
i
in
f
:
for
i
in
f
:
self
.
p
.
addgcode
(
i
)
self
.
p
.
addgcode
(
i
)
...
@@ -53,11 +53,10 @@ class window(wx.Frame):
...
@@ -53,11 +53,10 @@ class window(wx.Frame):
elif
z
<
0
:
self
.
p
.
zoom
(
event
.
GetX
(),
event
.
GetY
(),
1
/
1.2
)
elif
z
<
0
:
self
.
p
.
zoom
(
event
.
GetX
(),
event
.
GetY
(),
1
/
1.2
)
class
gviz
(
wx
.
Panel
):
class
gviz
(
wx
.
Panel
):
def
__init__
(
self
,
parent
,
size
=
(
200
,
200
),
b
edsize
=
(
200
,
200
),
center
=
(
100
,
100
)
,
grid
=
(
10
,
50
),
extrusion_width
=
0.5
):
def
__init__
(
self
,
parent
,
size
=
(
200
,
200
),
b
uild_dimensions
=
[
200
,
200
,
100
,
0
,
0
,
0
]
,
grid
=
(
10
,
50
),
extrusion_width
=
0.5
):
wx
.
Panel
.
__init__
(
self
,
parent
,
-
1
,
size
=
(
size
[
0
],
size
[
1
]))
wx
.
Panel
.
__init__
(
self
,
parent
,
-
1
,
size
=
(
size
[
0
],
size
[
1
]))
self
.
size
=
size
self
.
size
=
size
self
.
bedsize
=
bedsize
self
.
build_dimensions
=
build_dimensions
self
.
center
=
center
self
.
grid
=
grid
self
.
grid
=
grid
self
.
lastpos
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
]
self
.
lastpos
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
]
self
.
hilightpos
=
self
.
lastpos
[:]
self
.
hilightpos
=
self
.
lastpos
[:]
...
@@ -70,7 +69,7 @@ class gviz(wx.Panel):
...
@@ -70,7 +69,7 @@ class gviz(wx.Panel):
self
.
layers
=
[]
self
.
layers
=
[]
self
.
layerindex
=
0
self
.
layerindex
=
0
self
.
filament_width
=
extrusion_width
# set it to 0 to disable scaling lines with zoom
self
.
filament_width
=
extrusion_width
# set it to 0 to disable scaling lines with zoom
self
.
scale
=
[
min
(
float
(
size
[
0
])
/
b
edsize
[
0
],
float
(
size
[
1
])
/
bedsize
[
1
])]
*
2
self
.
scale
=
[
min
(
float
(
size
[
0
])
/
b
uild_dimensions
[
0
],
float
(
size
[
1
])
/
build_dimensions
[
1
])]
*
2
penwidth
=
max
(
1.0
,
self
.
filament_width
*
((
self
.
scale
[
0
]
+
self
.
scale
[
1
])
/
2.0
))
penwidth
=
max
(
1.0
,
self
.
filament_width
*
((
self
.
scale
[
0
]
+
self
.
scale
[
1
])
/
2.0
))
self
.
translate
=
[
0.0
,
0.0
]
self
.
translate
=
[
0.0
,
0.0
]
self
.
mainpen
=
wx
.
Pen
(
wx
.
Colour
(
0
,
0
,
0
),
penwidth
)
self
.
mainpen
=
wx
.
Pen
(
wx
.
Colour
(
0
,
0
,
0
),
penwidth
)
...
@@ -136,10 +135,10 @@ class gviz(wx.Panel):
...
@@ -136,10 +135,10 @@ class gviz(wx.Panel):
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
180
,
180
,
150
)))
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
180
,
180
,
150
)))
for
grid_unit
in
self
.
grid
:
for
grid_unit
in
self
.
grid
:
if
grid_unit
>
0
:
if
grid_unit
>
0
:
for
x
in
xrange
(
int
(
self
.
b
edsize
[
0
]
/
grid_unit
)
+
1
):
for
x
in
xrange
(
int
(
self
.
b
uild_dimensions
[
0
]
/
grid_unit
)
+
1
):
dc
.
DrawLine
(
self
.
translate
[
0
]
+
x
*
self
.
scale
[
0
]
*
grid_unit
,
self
.
translate
[
1
],
self
.
translate
[
0
]
+
x
*
self
.
scale
[
0
]
*
grid_unit
,
self
.
translate
[
1
]
+
self
.
scale
[
1
]
*
self
.
b
edsize
[
1
])
dc
.
DrawLine
(
self
.
translate
[
0
]
+
x
*
self
.
scale
[
0
]
*
grid_unit
,
self
.
translate
[
1
],
self
.
translate
[
0
]
+
x
*
self
.
scale
[
0
]
*
grid_unit
,
self
.
translate
[
1
]
+
self
.
scale
[
1
]
*
self
.
b
uild_dimensions
[
1
])
for
y
in
xrange
(
int
(
self
.
b
edsize
[
1
]
/
grid_unit
)
+
1
):
for
y
in
xrange
(
int
(
self
.
b
uild_dimensions
[
1
]
/
grid_unit
)
+
1
):
dc
.
DrawLine
(
self
.
translate
[
0
],
self
.
translate
[
1
]
+
y
*
self
.
scale
[
1
]
*
grid_unit
,
self
.
translate
[
0
]
+
self
.
scale
[
0
]
*
self
.
b
edsize
[
0
],
self
.
translate
[
1
]
+
y
*
self
.
scale
[
1
]
*
grid_unit
)
dc
.
DrawLine
(
self
.
translate
[
0
],
self
.
translate
[
1
]
+
y
*
self
.
scale
[
1
]
*
grid_unit
,
self
.
translate
[
0
]
+
self
.
scale
[
0
]
*
self
.
b
uild_dimensions
[
0
],
self
.
translate
[
1
]
+
y
*
self
.
scale
[
1
]
*
grid_unit
)
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
0
,
0
,
0
)))
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
0
,
0
,
0
)))
if
not
self
.
showall
:
if
not
self
.
showall
:
self
.
size
=
self
.
GetSize
()
self
.
size
=
self
.
GetSize
()
...
@@ -237,9 +236,9 @@ class gviz(wx.Panel):
...
@@ -237,9 +236,9 @@ class gviz(wx.Panel):
return
target
return
target
def
_y
(
y
):
def
_y
(
y
):
return
self
.
b
edsize
[
1
]
-
(
y
+
(
self
.
bedsize
[
0
]
/
2
-
self
.
center
[
0
])
)
return
self
.
b
uild_dimensions
[
1
]
-
(
y
-
self
.
build_dimensions
[
4
]
)
def
_x
(
x
):
def
_x
(
x
):
return
x
+
(
self
.
bedsize
[
0
]
/
2
-
self
.
center
[
0
])
return
x
-
self
.
build_dimensions
[
3
]
start_pos
=
self
.
hilightpos
[:]
if
hilight
else
self
.
lastpos
[:]
start_pos
=
self
.
hilightpos
[:]
if
hilight
else
self
.
lastpos
[:]
...
...
pronterface.py
View file @
5d4aad0c
...
@@ -57,10 +57,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -57,10 +57,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
settings
.
last_file_path
=
""
self
.
settings
.
last_file_path
=
""
self
.
settings
.
last_temperature
=
0.0
self
.
settings
.
last_temperature
=
0.0
self
.
settings
.
last_bed_temperature
=
0.0
self
.
settings
.
last_bed_temperature
=
0.0
self
.
settings
.
bed_size_x
=
200.
#default build dimensions are 200x200x100 with 0,0,0 in the corner of the bed
self
.
settings
.
bed_size_y
=
200.
self
.
settings
.
build_dimensions
=
'200x200x100+0+0+0'
self
.
settings
.
bed_center_x
=
100.
self
.
settings
.
bed_center_y
=
100.
self
.
settings
.
preview_grid_step1
=
10.
self
.
settings
.
preview_grid_step1
=
10.
self
.
settings
.
preview_grid_step2
=
50.
self
.
settings
.
preview_grid_step2
=
50.
self
.
settings
.
preview_extrusion_width
=
0.5
self
.
settings
.
preview_extrusion_width
=
0.5
...
@@ -86,7 +84,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -86,7 +84,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
]
]
self
.
custombuttons
=
[]
self
.
custombuttons
=
[]
self
.
btndict
=
{}
self
.
btndict
=
{}
print
self
.
settings
.
build_dimensions
self
.
parse_cmdline
(
sys
.
argv
[
1
:])
self
.
parse_cmdline
(
sys
.
argv
[
1
:])
print
self
.
settings
.
build_dimensions
self
.
build_dimensions_list
=
self
.
get_build_dimensions
(
self
.
settings
.
build_dimensions
)
print
self
.
build_dimensions_list
customdict
=
{}
customdict
=
{}
try
:
try
:
execfile
(
"custombtn.txt"
,
customdict
)
execfile
(
"custombtn.txt"
,
customdict
)
...
@@ -611,14 +613,12 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -611,14 +613,12 @@ 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
,(
300
,
300
),
self
.
gviz
=
gviz
.
gviz
(
self
.
panel
,(
300
,
300
),
bedsize
=
(
self
.
settings
.
bed_size_x
,
self
.
settings
.
bed_size_y
),
build_dimensions
=
self
.
build_dimensions_list
,
center
=
(
self
.
settings
.
bed_center_x
,
self
.
settings
.
bed_center_y
),
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
self
.
gwindow
=
gviz
.
window
([],
self
.
gwindow
=
gviz
.
window
([],
bedsize
=
(
self
.
settings
.
bed_size_x
,
self
.
settings
.
bed_size_y
),
build_dimensions
=
self
.
build_dimensions_list
,
center
=
(
self
.
settings
.
bed_center_x
,
self
.
settings
.
bed_center_y
),
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
.
Bind
(
wx
.
EVT_LEFT_DOWN
,
self
.
showwin
)
self
.
gviz
.
Bind
(
wx
.
EVT_LEFT_DOWN
,
self
.
showwin
)
...
@@ -1462,6 +1462,35 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1462,6 +1462,35 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Pause"
))
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
self
.
paused
=
0
self
.
paused
=
0
def
get_build_dimensions
(
self
,
bdim
):
import
re
# a string containing up to six numbers delimited by almost anything
# first 0-3 numbers specify the build volume, no sign, always positive
# remaining 0-3 numbers specify the coordinates of the "southwest" corner of the build platform
# "XXX,YYY"
# "XXXxYYY+xxx-yyy"
# "XXX,YYY,ZZZ+xxx+yyy-zzz"
# etc
bdl
=
re
.
match
(
"[^
\
d+-]*(
\
d+)?"
+
# X build size
"[^
\
d+-]*(
\
d+)?"
+
# Y build size
"[^
\
d+-]*(
\
d+)?"
+
# Z build size
"[^
\
d+-]*([+-]
\
d+)?"
+
# X corner coordinate
"[^
\
d+-]*([+-]
\
d+)?"
+
# Y corner coordinate
"[^
\
d+-]*([+-]
\
d+)?"
# Z corner coordinate
,
bdim
)
.
groups
()
print
bdl
bdl_float
=
[
200.0
if
bdl
[
0
]
==
None
else
float
(
bdl
[
0
]),
200.0
if
bdl
[
1
]
==
None
else
float
(
bdl
[
1
]),
100.0
if
bdl
[
2
]
==
None
else
float
(
bdl
[
2
]),
0.0
if
bdl
[
3
]
==
None
else
float
(
bdl
[
3
]),
0.0
if
bdl
[
4
]
==
None
else
float
(
bdl
[
4
]),
0.0
if
bdl
[
5
]
==
None
else
float
(
bdl
[
5
]),
]
return
bdl_float
class
macroed
(
wx
.
Dialog
):
class
macroed
(
wx
.
Dialog
):
"""Really simple editor to edit macro definitions"""
"""Really simple editor to edit macro definitions"""
...
...
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