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
d6bd9e75
Commit
d6bd9e75
authored
Apr 03, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Flake8 cleanup
parent
25717357
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
169 additions
and
262 deletions
+169
-262
calibrateextruder.py
calibrateextruder.py
+6
-6
bmpDisplay.py
printrun/bmpDisplay.py
+0
-91
gcoder.py
printrun/gcoder.py
+5
-5
gcview.py
printrun/gcview.py
+0
-2
bufferedcanvas.py
printrun/gui/bufferedcanvas.py
+6
-6
controls.py
printrun/gui/controls.py
+8
-8
graph.py
printrun/gui/graph.py
+21
-21
log.py
printrun/gui/log.py
+0
-2
widgets.py
printrun/gui/widgets.py
+7
-11
xybuttons.py
printrun/gui/xybuttons.py
+3
-3
zbuttons.py
printrun/gui/zbuttons.py
+3
-3
gviz.py
printrun/gviz.py
+3
-3
packer.py
printrun/packer.py
+39
-39
pronterface.py
printrun/pronterface.py
+21
-21
stlplater.py
printrun/stlplater.py
+9
-9
stltool.py
printrun/stltool.py
+6
-6
stlview.py
printrun/stlview.py
+23
-17
zscaper.py
printrun/zscaper.py
+6
-6
pronterface.py
pronterface.py
+1
-1
setup.py
setup.py
+2
-2
No files found.
printrun/
calibrateextruder.py
→
calibrateextruder.py
View file @
d6bd9e75
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
#Interactive RepRap e axis calibration program
#
Interactive RepRap e axis calibration program
#(C) Nathan Zadoks 2011
#
(C) Nathan Zadoks 2011
s
=
300
# Extrusion speed (mm/min)
s
=
300
# Extrusion speed (mm/min)
n
=
100
# Default length to extrude
n
=
100
# Default length to extrude
...
@@ -95,7 +95,7 @@ def gettemp(p):
...
@@ -95,7 +95,7 @@ def gettemp(p):
if
not
os
.
path
.
exists
(
port
):
if
not
os
.
path
.
exists
(
port
):
port
=
0
port
=
0
#Parse options
#
Parse options
help
=
u"""
help
=
u"""
%
s [ -l DISTANCE ] [ -s STEPS ] [ -t TEMP ] [ -p PORT ]
%
s [ -l DISTANCE ] [ -s STEPS ] [ -t TEMP ] [ -p PORT ]
-l --length Length of filament to extrude for each calibration step (default:
%
d mm)
-l --length Length of filament to extrude for each calibration step (default:
%
d mm)
...
@@ -126,7 +126,7 @@ for o, a in opts:
...
@@ -126,7 +126,7 @@ for o, a in opts:
elif
o
in
(
'-p'
,
'--port'
):
elif
o
in
(
'-p'
,
'--port'
):
port
=
a
port
=
a
#Show initial parameters
#
Show initial parameters
print
"Initial parameters"
print
"Initial parameters"
print
"Steps per mm:
%3
d steps"
%
k
print
"Steps per mm:
%3
d steps"
%
k
print
"Length extruded:
%3
d mm"
%
n
print
"Length extruded:
%3
d mm"
%
n
...
@@ -135,7 +135,7 @@ print "Serial port: %s" % (port if port else 'auto')
...
@@ -135,7 +135,7 @@ print "Serial port: %s" % (port if port else 'auto')
p
=
None
p
=
None
try
:
try
:
#Connect to printer
#
Connect to printer
w
(
"Connecting to printer.."
)
w
(
"Connecting to printer.."
)
try
:
try
:
p
=
printcore
(
port
,
115200
)
p
=
printcore
(
port
,
115200
)
...
@@ -149,7 +149,7 @@ try:
...
@@ -149,7 +149,7 @@ try:
heatup
(
p
,
temp
)
heatup
(
p
,
temp
)
#Calibration loop
#
Calibration loop
while
n
!=
m
:
while
n
!=
m
:
heatup
(
p
,
temp
,
True
)
heatup
(
p
,
temp
,
True
)
p
.
send_now
(
"G92 E0"
)
# Reset e axis
p
.
send_now
(
"G92 E0"
)
# Reset e axis
...
...
printrun/bmpDisplay.py
deleted
100644 → 0
View file @
25717357
# This file is part of the Printrun suite.
#
# Printrun is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Printrun is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
# create a simple image slide show using the
# wx.PaintDC surface as a canvas and
# DrawBitmap(bitmap, x, y, bool transparent)
# Source: vegaseat
import
wx
import
os
import
zipfile
import
tempfile
import
shutil
class
MyFrame
(
wx
.
Frame
):
def
__init__
(
self
,
parent
,
mysize
):
wx
.
Frame
.
__init__
(
self
,
parent
,
wx
.
ID_ANY
,
size
=
mysize
)
self
.
SetBackgroundColour
(
'black'
)
# milliseconds per frame
self
.
delay
=
60
# number of loops
self
.
loops
=
1
zipfilename
=
'images/out.3dlp.zip'
if
not
zipfile
.
is_zipfile
(
zipfilename
):
raise
Exception
(
zipfilename
+
" is not a zip file!"
)
zip
=
zipfile
.
ZipFile
(
zipfilename
,
'r'
)
self
.
mytmpdir
=
tempfile
.
mkdtemp
()
zip
.
extractall
(
self
.
mytmpdir
)
image_type
=
".bmp"
image_dir
=
self
.
mytmpdir
file_list
=
[]
self
.
name_list
=
[]
for
file
in
os
.
listdir
(
image_dir
):
path
=
os
.
path
.
join
(
image_dir
,
file
)
if
os
.
path
.
isfile
(
path
)
and
path
.
endswith
(
image_type
):
# just the file name
self
.
name_list
.
append
(
file
)
# full path name
file_list
.
append
(
path
)
# create a list of image objects
self
.
image_list
=
[]
for
image_file
in
file_list
:
self
.
image_list
.
append
(
wx
.
Bitmap
(
image_file
))
# bind the panel to the paint event
wx
.
EVT_PAINT
(
self
,
self
.
onPaint
)
def
__del__
(
self
):
if
self
.
mytmpdir
:
shutil
.
rmtree
(
self
.
mytmpdir
)
def
onPaint
(
self
,
event
=
None
):
# this is the wxPython drawing surface/canvas
dc
=
wx
.
PaintDC
(
self
)
while
self
.
loops
:
self
.
loops
-=
1
for
ix
,
bmp
in
enumerate
(
self
.
image_list
):
# optionally show some image information
w
,
h
=
bmp
.
GetSize
()
info
=
"
%
s
%
dx
%
d"
%
(
self
.
name_list
[
ix
],
w
,
h
)
self
.
SetTitle
(
info
)
#self.SetSize((w, h))
# draw the image
dc
.
DrawBitmap
(
bmp
,
0
,
0
,
True
)
wx
.
MilliSleep
(
self
.
delay
)
# don't clear on fast slide shows to avoid flicker
if
self
.
delay
>
200
:
dc
.
Clear
()
app
=
wx
.
App
()
width
=
800
frameoffset
=
35
height
=
600
+
frameoffset
MyFrame
(
None
,
(
width
,
height
))
.
Show
()
app
.
MainLoop
()
printrun/gcoder.py
View file @
d6bd9e75
...
@@ -271,7 +271,7 @@ class GCode(object):
...
@@ -271,7 +271,7 @@ class GCode(object):
cur_layer_has_extrusion
=
False
cur_layer_has_extrusion
=
False
for
line
in
lines
:
for
line
in
lines
:
## Parse line
#
# Parse line
split_raw
=
split
(
line
)
split_raw
=
split
(
line
)
if
line
.
command
:
if
line
.
command
:
# Update properties
# Update properties
...
@@ -342,7 +342,7 @@ class GCode(object):
...
@@ -342,7 +342,7 @@ class GCode(object):
line
.
current_y
=
current_y
line
.
current_y
=
current_y
line
.
current_z
=
current_z
line
.
current_z
=
current_z
## Process extrusion
#
# Process extrusion
if
line
.
e
is
not
None
:
if
line
.
e
is
not
None
:
if
line
.
is_move
:
if
line
.
is_move
:
if
line
.
relative_e
:
if
line
.
relative_e
:
...
@@ -358,7 +358,7 @@ class GCode(object):
...
@@ -358,7 +358,7 @@ class GCode(object):
elif
line
.
command
==
"G92"
:
elif
line
.
command
==
"G92"
:
offset_e
=
current_e
-
line
.
e
offset_e
=
current_e
-
line
.
e
## Create layers
#
# Create layers
if
not
build_layers
:
if
not
build_layers
:
continue
continue
# FIXME : looks like this needs to be tested with "lift Z on move"
# FIXME : looks like this needs to be tested with "lift Z on move"
...
@@ -413,7 +413,7 @@ class GCode(object):
...
@@ -413,7 +413,7 @@ class GCode(object):
line_idxs
.
append
(
layer_line
)
line_idxs
.
append
(
layer_line
)
layer_line
+=
1
layer_line
+=
1
prev_z
=
cur_z
prev_z
=
cur_z
### Loop done
#
## Loop done
# Store current status
# Store current status
self
.
imperial
=
imperial
self
.
imperial
=
imperial
...
@@ -494,7 +494,7 @@ class GCode(object):
...
@@ -494,7 +494,7 @@ class GCode(object):
totalduration
=
0.0
totalduration
=
0.0
acceleration
=
2000.0
# mm/s^2
acceleration
=
2000.0
# mm/s^2
layerbeginduration
=
0.0
layerbeginduration
=
0.0
#TODO:
#
TODO:
# get device caps from firmware: max speed, acceleration/axis
# get device caps from firmware: max speed, acceleration/axis
# (including extruder)
# (including extruder)
# calculate the maximum move duration accounting for above ;)
# calculate the maximum move duration accounting for above ;)
...
...
printrun/gcview.py
View file @
d6bd9e75
...
@@ -22,11 +22,9 @@ from . import gcoder
...
@@ -22,11 +22,9 @@ from . import gcoder
from
.gl.panel
import
wxGLPanel
from
.gl.panel
import
wxGLPanel
from
.gl.trackball
import
build_rotmatrix
from
.gl.trackball
import
build_rotmatrix
from
.gl.libtatlin
import
actors
from
.gl.libtatlin
import
actors
from
.gl.libtatlin.actors
import
vec
from
pyglet.gl
import
glPushMatrix
,
glPopMatrix
,
\
from
pyglet.gl
import
glPushMatrix
,
glPopMatrix
,
\
glTranslatef
,
glRotatef
,
glScalef
,
glMultMatrixd
glTranslatef
,
glRotatef
,
glScalef
,
glMultMatrixd
from
pyglet.gl
import
*
from
.gviz
import
GvizBaseFrame
from
.gviz
import
GvizBaseFrame
...
...
printrun/gui/bufferedcanvas.py
View file @
d6bd9e75
...
@@ -73,9 +73,9 @@ class BufferedCanvas(wx.Panel):
...
@@ -73,9 +73,9 @@ class BufferedCanvas(wx.Panel):
pass
# the sauce, please
pass
# the sauce, please
self
.
Bind
(
wx
.
EVT_ERASE_BACKGROUND
,
disable_event
)
self
.
Bind
(
wx
.
EVT_ERASE_BACKGROUND
,
disable_event
)
#
#
#
#
#
General methods
# General methods
#
#
#
def
draw
(
self
,
dc
,
w
,
h
):
def
draw
(
self
,
dc
,
w
,
h
):
"""
"""
...
@@ -97,9 +97,9 @@ class BufferedCanvas(wx.Panel):
...
@@ -97,9 +97,9 @@ class BufferedCanvas(wx.Panel):
height
=
1
height
=
1
return
(
width
,
height
)
return
(
width
,
height
)
#
#
#
#
#
Event handlers
# Event handlers
#
#
#
def
onPaint
(
self
,
event
):
def
onPaint
(
self
,
event
):
# Blit the front buffer to the screen
# Blit the front buffer to the screen
...
...
printrun/gui/controls.py
View file @
d6bd9e75
...
@@ -123,7 +123,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
...
@@ -123,7 +123,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
container
=
self
container
=
self
container
.
Add
(
widget
,
*
args
,
**
kwargs
)
container
.
Add
(
widget
,
*
args
,
**
kwargs
)
#
# Hotend & bed temperatures
#
Hotend & bed temperatures #
# Hotend temp
# Hotend temp
add
(
"htemp_label"
,
wx
.
StaticText
(
parentpanel
,
-
1
,
_
(
"Heat:"
)),
flag
=
wx
.
ALIGN_CENTER_VERTICAL
|
wx
.
ALIGN_RIGHT
)
add
(
"htemp_label"
,
wx
.
StaticText
(
parentpanel
,
-
1
,
_
(
"Heat:"
)),
flag
=
wx
.
ALIGN_CENTER_VERTICAL
|
wx
.
ALIGN_RIGHT
)
...
@@ -168,8 +168,8 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
...
@@ -168,8 +168,8 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
root
.
btemp
.
SetValue
(
str
(
root
.
settings
.
last_bed_temperature
))
root
.
btemp
.
SetValue
(
str
(
root
.
settings
.
last_bed_temperature
))
root
.
htemp
.
SetValue
(
str
(
root
.
settings
.
last_temperature
))
root
.
htemp
.
SetValue
(
str
(
root
.
settings
.
last_temperature
))
#
#
added for an error where only the bed would get (pla) or (abs).
# added for an error where only the bed would get (pla) or (abs).
#This ensures, if last temp is a default pla or abs, it will be marked so.
#
This ensures, if last temp is a default pla or abs, it will be marked so.
# if it is not, then a (user) remark is added. This denotes a manual entry
# if it is not, then a (user) remark is added. This denotes a manual entry
for
i
in
btemp_choices
:
for
i
in
btemp_choices
:
...
@@ -184,7 +184,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
...
@@ -184,7 +184,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
if
'('
not
in
root
.
htemp
.
Value
:
if
'('
not
in
root
.
htemp
.
Value
:
root
.
htemp
.
SetValue
(
root
.
htemp
.
Value
+
' (user)'
)
root
.
htemp
.
SetValue
(
root
.
htemp
.
Value
+
' (user)'
)
#
# Speed control
#
Speed control #
speedpanel
=
root
.
newPanel
(
parentpanel
)
speedpanel
=
root
.
newPanel
(
parentpanel
)
speedsizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
speedsizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
speedsizer
.
Add
(
wx
.
StaticText
(
speedpanel
,
-
1
,
_
(
"Print speed:"
)),
flag
=
wx
.
ALIGN_CENTER_VERTICAL
|
wx
.
ALIGN_RIGHT
)
speedsizer
.
Add
(
wx
.
StaticText
(
speedpanel
,
-
1
,
_
(
"Print speed:"
)),
flag
=
wx
.
ALIGN_CENTER_VERTICAL
|
wx
.
ALIGN_RIGHT
)
...
@@ -210,7 +210,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
...
@@ -210,7 +210,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
root
.
speed_label
.
SetLabel
(
_
(
"
%
d
%%
"
)
%
value
)
root
.
speed_label
.
SetLabel
(
_
(
"
%
d
%%
"
)
%
value
)
root
.
speed_slider
.
Bind
(
wx
.
EVT_SCROLL
,
speedslider_scroll
)
root
.
speed_slider
.
Bind
(
wx
.
EVT_SCROLL
,
speedslider_scroll
)
#
# Temperature gauges
#
Temperature gauges #
if
root
.
display_gauges
:
if
root
.
display_gauges
:
root
.
hottgauge
=
TempGauge
(
parentpanel
,
size
=
(
-
1
,
24
),
title
=
_
(
"Heater:"
),
maxval
=
300
,
bgcolor
=
root
.
bgcolor
)
root
.
hottgauge
=
TempGauge
(
parentpanel
,
size
=
(
-
1
,
24
),
title
=
_
(
"Heater:"
),
maxval
=
300
,
bgcolor
=
root
.
bgcolor
)
...
@@ -234,7 +234,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
...
@@ -234,7 +234,7 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
root
.
hottgauge
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
hotendgauge_scroll_setpoint
)
root
.
hottgauge
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
hotendgauge_scroll_setpoint
)
root
.
bedtgauge
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
bedgauge_scroll_setpoint
)
root
.
bedtgauge
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
bedgauge_scroll_setpoint
)
#
# Temperature (M105) feedback display
#
Temperature (M105) feedback display #
root
.
tempdisp
=
wx
.
StaticText
(
parentpanel
,
-
1
,
""
,
style
=
wx
.
ST_NO_AUTORESIZE
)
root
.
tempdisp
=
wx
.
StaticText
(
parentpanel
,
-
1
,
""
,
style
=
wx
.
ST_NO_AUTORESIZE
)
def
on_tempdisp_size
(
evt
):
def
on_tempdisp_size
(
evt
):
...
@@ -248,14 +248,14 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
...
@@ -248,14 +248,14 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
root
.
tempdisp
.
SetLabel
=
tempdisp_setlabel
root
.
tempdisp
.
SetLabel
=
tempdisp_setlabel
add
(
"tempdisp"
,
root
.
tempdisp
,
flag
=
wx
.
EXPAND
)
add
(
"tempdisp"
,
root
.
tempdisp
,
flag
=
wx
.
EXPAND
)
#
# Temperature graph
#
Temperature graph #
if
root
.
display_graph
:
if
root
.
display_graph
:
root
.
graph
=
Graph
(
parentpanel
,
wx
.
ID_ANY
,
root
)
root
.
graph
=
Graph
(
parentpanel
,
wx
.
ID_ANY
,
root
)
add
(
"tempgraph"
,
root
.
graph
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
,
border
=
5
)
add
(
"tempgraph"
,
root
.
graph
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
,
border
=
5
)
root
.
graph
.
Bind
(
wx
.
EVT_LEFT_DOWN
,
root
.
graph
.
show_graph_window
)
root
.
graph
.
Bind
(
wx
.
EVT_LEFT_DOWN
,
root
.
graph
.
show_graph_window
)
#
# Extrusion controls
#
Extrusion controls #
# Extrusion settings
# Extrusion settings
esettingspanel
=
root
.
newPanel
(
parentpanel
)
esettingspanel
=
root
.
newPanel
(
parentpanel
)
...
...
printrun/gui/graph.py
View file @
d6bd9e75
...
@@ -67,8 +67,8 @@ class Graph(BufferedCanvas):
...
@@ -67,8 +67,8 @@ class Graph(BufferedCanvas):
if
self
.
rescaley
:
if
self
.
rescaley
:
self
.
_ybounds
=
Graph
.
_YBounds
(
self
)
self
.
_ybounds
=
Graph
.
_YBounds
(
self
)
#If rescaley is set then ybars gives merely an estimate
#
If rescaley is set then ybars gives merely an estimate
#Note that "bars" actually indicate the number of internal+external gridlines.
#
Note that "bars" actually indicate the number of internal+external gridlines.
self
.
ybars
=
5
self
.
ybars
=
5
self
.
xbars
=
7
# One bar per 10 second
self
.
xbars
=
7
# One bar per 10 second
self
.
xsteps
=
60
# Covering 1 minute in the graph
self
.
xsteps
=
60
# Covering 1 minute in the graph
...
@@ -99,22 +99,22 @@ class Graph(BufferedCanvas):
...
@@ -99,22 +99,22 @@ class Graph(BufferedCanvas):
self
.
Refresh
()
self
.
Refresh
()
def
drawgrid
(
self
,
dc
,
gc
):
def
drawgrid
(
self
,
dc
,
gc
):
#cold, medium, hot = wx.Colour(0, 167, 223),\
#
cold, medium, hot = wx.Colour(0, 167, 223),\
# wx.Colour(239, 233, 119),\
# wx.Colour(239, 233, 119),\
# wx.Colour(210, 50.100)
# wx.Colour(210, 50.100)
#col1 = wx.Colour(255, 0, 0, 255)
#
col1 = wx.Colour(255, 0, 0, 255)
#col2 = wx.Colour(255, 255, 255, 128)
#
col2 = wx.Colour(255, 255, 255, 128)
#b = gc.CreateLinearGradientBrush(0, 0, w, h, col1, col2)
#
b = gc.CreateLinearGradientBrush(0, 0, w, h, col1, col2)
gc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
255
,
0
,
0
,
0
),
1
))
gc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
255
,
0
,
0
,
0
),
1
))
#gc.SetBrush(wx.Brush(wx.Colour(245, 245, 255, 52)))
#
gc.SetBrush(wx.Brush(wx.Colour(245, 245, 255, 52)))
#gc.SetBrush(gc.CreateBrush(wx.Brush(wx.Colour(0, 0, 0, 255))))
#
gc.SetBrush(gc.CreateBrush(wx.Brush(wx.Colour(0, 0, 0, 255))))
gc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
255
,
0
,
0
,
255
),
1
))
gc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
255
,
0
,
0
,
255
),
1
))
#gc.DrawLines(wx.Point(0, 0), wx.Point(50, 10))
#
gc.DrawLines(wx.Point(0, 0), wx.Point(50, 10))
font
=
wx
.
Font
(
10
,
wx
.
DEFAULT
,
wx
.
NORMAL
,
wx
.
BOLD
)
font
=
wx
.
Font
(
10
,
wx
.
DEFAULT
,
wx
.
NORMAL
,
wx
.
BOLD
)
gc
.
SetFont
(
font
,
wx
.
Colour
(
23
,
44
,
44
))
gc
.
SetFont
(
font
,
wx
.
Colour
(
23
,
44
,
44
))
...
@@ -134,7 +134,7 @@ class Graph(BufferedCanvas):
...
@@ -134,7 +134,7 @@ class Graph(BufferedCanvas):
firstbar
=
int
(
ceil
(
self
.
minyvalue
/
spacing
))
# in degrees
firstbar
=
int
(
ceil
(
self
.
minyvalue
/
spacing
))
# in degrees
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
225
,
225
,
225
),
1
))
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
225
,
225
,
225
),
1
))
for
y
in
range
(
firstbar
,
firstbar
+
ybars
+
1
):
for
y
in
range
(
firstbar
,
firstbar
+
ybars
+
1
):
#y_pos = y*(float(self.height)/self.ybars)
#
y_pos = y*(float(self.height)/self.ybars)
degrees
=
y
*
spacing
degrees
=
y
*
spacing
y_pos
=
self
.
_y_pos
(
degrees
)
y_pos
=
self
.
_y_pos
(
degrees
)
dc
.
DrawLine
(
0
,
y_pos
,
self
.
width
,
y_pos
)
dc
.
DrawLine
(
0
,
y_pos
,
self
.
width
,
y_pos
)
...
@@ -148,15 +148,15 @@ class Graph(BufferedCanvas):
...
@@ -148,15 +148,15 @@ class Graph(BufferedCanvas):
self
.
width
/
2
-
(
font
.
GetPointSize
()
*
3
),
self
.
width
/
2
-
(
font
.
GetPointSize
()
*
3
),
self
.
height
/
2
-
(
font
.
GetPointSize
()
*
1
))
self
.
height
/
2
-
(
font
.
GetPointSize
()
*
1
))
#dc.DrawCircle(50, 50, 1)
#
dc.DrawCircle(50, 50, 1)
#gc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 1))
#
gc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 1))
#gc.DrawLines([[20, 30], [10, 53]])
#
gc.DrawLines([[20, 30], [10, 53]])
#dc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 1))
#
dc.SetPen(wx.Pen(wx.Colour(255, 0, 0, 0), 1))
def
_y_pos
(
self
,
temperature
):
def
_y_pos
(
self
,
temperature
):
"""Converts a temperature, in degrees, to a pixel position"""
"""Converts a temperature, in degrees, to a pixel position"""
#fraction of the screen from the bottom
#
fraction of the screen from the bottom
frac
=
(
float
(
temperature
-
self
.
minyvalue
)
frac
=
(
float
(
temperature
-
self
.
minyvalue
)
/
(
self
.
maxyvalue
-
self
.
minyvalue
))
/
(
self
.
maxyvalue
-
self
.
minyvalue
))
return
int
((
1.0
-
frac
)
*
(
self
.
height
-
1
))
return
int
((
1.0
-
frac
)
*
(
self
.
height
-
1
))
...
@@ -168,7 +168,7 @@ class Graph(BufferedCanvas):
...
@@ -168,7 +168,7 @@ class Graph(BufferedCanvas):
log_yspan
=
log10
(
yspan
/
self
.
ybars
)
log_yspan
=
log10
(
yspan
/
self
.
ybars
)
exponent
=
int
(
floor
(
log_yspan
))
exponent
=
int
(
floor
(
log_yspan
))
#calculate boundary points between allowed spacings
#
calculate boundary points between allowed spacings
log1_25
=
log10
(
2
)
+
log10
(
1
)
+
log10
(
2.5
)
-
log10
(
1
+
2.5
)
log1_25
=
log10
(
2
)
+
log10
(
1
)
+
log10
(
2.5
)
-
log10
(
1
+
2.5
)
log25_5
=
log10
(
2
)
+
log10
(
2.5
)
+
log10
(
5
)
-
log10
(
2.5
+
5
)
log25_5
=
log10
(
2
)
+
log10
(
2.5
)
+
log10
(
5
)
-
log10
(
2.5
+
5
)
log5_10
=
log10
(
2
)
+
log10
(
5
)
+
log10
(
10
)
-
log10
(
5
+
10
)
log5_10
=
log10
(
2
)
+
log10
(
5
)
+
log10
(
10
)
-
log10
(
5
+
10
)
...
@@ -205,7 +205,7 @@ class Graph(BufferedCanvas):
...
@@ -205,7 +205,7 @@ class Graph(BufferedCanvas):
if
len
(
text
)
>
0
:
if
len
(
text
)
>
0
:
font
=
wx
.
Font
(
8
,
wx
.
DEFAULT
,
wx
.
NORMAL
,
wx
.
BOLD
)
font
=
wx
.
Font
(
8
,
wx
.
DEFAULT
,
wx
.
NORMAL
,
wx
.
BOLD
)
#font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
#
font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
if
self
.
timer
.
IsRunning
()
is
False
:
if
self
.
timer
.
IsRunning
()
is
False
:
gc
.
SetFont
(
font
,
wx
.
Colour
(
128
,
128
,
128
))
gc
.
SetFont
(
font
,
wx
.
Colour
(
128
,
128
,
128
))
else
:
else
:
...
@@ -337,7 +337,7 @@ class Graph(BufferedCanvas):
...
@@ -337,7 +337,7 @@ class Graph(BufferedCanvas):
# Frequency to rescale the graph
# Frequency to rescale the graph
self
.
update_freq
=
10
self
.
update_freq
=
10
#number of updates since last full refresh
#
number of updates since last full refresh
self
.
_last_update
=
self
.
update_freq
self
.
_last_update
=
self
.
update_freq
def
update
(
self
,
forceUpdate
=
False
):
def
update
(
self
,
forceUpdate
=
False
):
...
@@ -418,7 +418,7 @@ class Graph(BufferedCanvas):
...
@@ -418,7 +418,7 @@ class Graph(BufferedCanvas):
miny
=
min
(
miny
,
bed_min
,
bed_target
)
miny
=
min
(
miny
,
bed_min
,
bed_target
)
maxy
=
max
(
maxy
,
bed_max
,
bed_target
)
maxy
=
max
(
maxy
,
bed_max
,
bed_target
)
#We have to rescale, so add padding
#
We have to rescale, so add padding
bufratio
=
self
.
buffer
/
(
1.0
-
self
.
buffer
)
bufratio
=
self
.
buffer
/
(
1.0
-
self
.
buffer
)
if
miny
<
self
.
graph
.
minyvalue
:
if
miny
<
self
.
graph
.
minyvalue
:
padding
=
(
self
.
graph
.
maxyvalue
-
miny
)
*
bufratio
padding
=
(
self
.
graph
.
maxyvalue
-
miny
)
*
bufratio
...
...
printrun/gui/log.py
View file @
d6bd9e75
...
@@ -34,9 +34,7 @@ class LogPane(wx.BoxSizer):
...
@@ -34,9 +34,7 @@ class LogPane(wx.BoxSizer):
root
.
commandbox
.
Bind
(
wx
.
EVT_CHAR
,
root
.
cbkey
)
root
.
commandbox
.
Bind
(
wx
.
EVT_CHAR
,
root
.
cbkey
)
root
.
commandbox
.
history
=
[
u""
]
root
.
commandbox
.
history
=
[
u""
]
root
.
commandbox
.
histindex
=
1
root
.
commandbox
.
histindex
=
1
#root.printerControls.append(root.commandbox)
lbrs
.
Add
(
root
.
commandbox
,
1
)
lbrs
.
Add
(
root
.
commandbox
,
1
)
root
.
sendbtn
=
make_button
(
bottom_panel
,
_
(
"Send"
),
root
.
sendline
,
_
(
"Send Command to Printer"
),
style
=
wx
.
BU_EXACTFIT
,
container
=
lbrs
)
root
.
sendbtn
=
make_button
(
bottom_panel
,
_
(
"Send"
),
root
.
sendline
,
_
(
"Send Command to Printer"
),
style
=
wx
.
BU_EXACTFIT
,
container
=
lbrs
)
#root.printerControls.append(root.sendbtn)
bottom_panel
.
SetSizer
(
lbrs
)
bottom_panel
.
SetSizer
(
lbrs
)
self
.
Add
(
bottom_panel
,
0
,
wx
.
EXPAND
)
self
.
Add
(
bottom_panel
,
0
,
wx
.
EXPAND
)
printrun/gui/widgets.py
View file @
d6bd9e75
...
@@ -31,7 +31,6 @@ class MacroEditor(wx.Dialog):
...
@@ -31,7 +31,6 @@ class MacroEditor(wx.Dialog):
self
.
panel
=
wx
.
Panel
(
self
,
-
1
)
self
.
panel
=
wx
.
Panel
(
self
,
-
1
)
titlesizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
titlesizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
self
.
titletext
=
wx
.
StaticText
(
self
.
panel
,
-
1
,
" _"
)
# title%macro_name)
self
.
titletext
=
wx
.
StaticText
(
self
.
panel
,
-
1
,
" _"
)
# title%macro_name)
#title.SetFont(wx.Font(11, wx.NORMAL, wx.NORMAL, wx.BOLD))
titlesizer
.
Add
(
self
.
titletext
,
1
)
titlesizer
.
Add
(
self
.
titletext
,
1
)
self
.
findb
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Find"
),
style
=
wx
.
BU_EXACTFIT
)
# New button for "Find" (Jezmy)
self
.
findb
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Find"
),
style
=
wx
.
BU_EXACTFIT
)
# New button for "Find" (Jezmy)
self
.
findb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
find
)
self
.
findb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
find
)
...
@@ -66,11 +65,8 @@ class MacroEditor(wx.Dialog):
...
@@ -66,11 +65,8 @@ class MacroEditor(wx.Dialog):
somecode
=
self
.
e
.
GetValue
()
somecode
=
self
.
e
.
GetValue
()
position
=
somecode
.
find
(
FindValue
,
self
.
e
.
GetInsertionPoint
())
position
=
somecode
.
find
(
FindValue
,
self
.
e
.
GetInsertionPoint
())
if
position
==
-
1
:
if
position
==
-
1
:
# ShowMessage(self,-1, "Not found!")
self
.
titletext
.
SetLabel
(
_
(
"Not Found!"
))
self
.
titletext
.
SetLabel
(
_
(
"Not Found!"
))
else
:
else
:
# self.title.SetValue("Position : "+str(position))
self
.
titletext
.
SetLabel
(
str
(
position
))
self
.
titletext
.
SetLabel
(
str
(
position
))
# ananswer = wx.MessageBox(str(numLines)+" Lines detected in file\n"+str(position), "OK")
# ananswer = wx.MessageBox(str(numLines)+" Lines detected in file\n"+str(position), "OK")
...
@@ -101,7 +97,6 @@ class MacroEditor(wx.Dialog):
...
@@ -101,7 +97,6 @@ class MacroEditor(wx.Dialog):
self
.
indent_chars
=
" "
self
.
indent_chars
=
" "
unindented
=
""
unindented
=
""
lines
=
re
.
split
(
r"(?:\r\n?|\n)"
,
text
)
lines
=
re
.
split
(
r"(?:\r\n?|\n)"
,
text
)
#print lines
if
len
(
lines
)
<=
1
:
if
len
(
lines
)
<=
1
:
return
text
return
text
for
line
in
lines
:
for
line
in
lines
:
...
@@ -293,7 +288,8 @@ class TempGauge(wx.Panel):
...
@@ -293,7 +288,8 @@ class TempGauge(wx.Panel):
dc
.
SetBackground
(
wx
.
Brush
(
self
.
bgcolor
))
dc
.
SetBackground
(
wx
.
Brush
(
self
.
bgcolor
))
dc
.
Clear
()
dc
.
Clear
()
cold
,
medium
,
hot
=
wx
.
Colour
(
0
,
167
,
223
),
wx
.
Colour
(
239
,
233
,
119
),
wx
.
Colour
(
210
,
50.100
)
cold
,
medium
,
hot
=
wx
.
Colour
(
0
,
167
,
223
),
wx
.
Colour
(
239
,
233
,
119
),
wx
.
Colour
(
210
,
50.100
)
gauge1
,
gauge2
=
wx
.
Colour
(
255
,
255
,
210
),
(
self
.
gaugeColour
or
wx
.
Colour
(
234
,
82
,
0
))
# gauge1, gauge2 = wx.Colour(255, 255, 210), (self.gaugeColour or wx.Colour(234, 82, 0))
gauge1
=
wx
.
Colour
(
255
,
255
,
210
)
shadow1
,
shadow2
=
wx
.
Colour
(
110
,
110
,
110
),
self
.
bgcolor
shadow1
,
shadow2
=
wx
.
Colour
(
110
,
110
,
110
),
self
.
bgcolor
gc
=
wx
.
GraphicsContext
.
Create
(
dc
)
gc
=
wx
.
GraphicsContext
.
Create
(
dc
)
# draw shadow first
# draw shadow first
...
@@ -319,8 +315,8 @@ class TempGauge(wx.Panel):
...
@@ -319,8 +315,8 @@ class TempGauge(wx.Panel):
w1
=
y0
+
9
-
width
/
2
w1
=
y0
+
9
-
width
/
2
w2
=
w1
+
width
w2
=
w1
+
width
value
=
x0
+
max
(
10
,
min
(
self
.
width
+
1
-
2
,
int
(
self
.
value
*
self
.
scale
)))
value
=
x0
+
max
(
10
,
min
(
self
.
width
+
1
-
2
,
int
(
self
.
value
*
self
.
scale
)))
#gc.SetBrush(gc.CreateLinearGradientBrush(x0, y0 + 3, x0, y0 + 15, gauge1, gauge2))
#
gc.SetBrush(gc.CreateLinearGradientBrush(x0, y0 + 3, x0, y0 + 15, gauge1, gauge2))
#gc.SetBrush(gc.CreateLinearGradientBrush(0, 3, 0, 15, wx.Colour(255, 255, 255), wx.Colour(255, 90, 32)))
#
gc.SetBrush(gc.CreateLinearGradientBrush(0, 3, 0, 15, wx.Colour(255, 255, 255), wx.Colour(255, 90, 32)))
gc
.
SetBrush
(
gc
.
CreateLinearGradientBrush
(
x0
,
y0
+
3
,
x0
,
y0
+
15
,
gauge1
,
self
.
interpolatedColour
(
value
,
x0
,
x1
,
xE
,
cold
,
medium
,
hot
)))
gc
.
SetBrush
(
gc
.
CreateLinearGradientBrush
(
x0
,
y0
+
3
,
x0
,
y0
+
15
,
gauge1
,
self
.
interpolatedColour
(
value
,
x0
,
x1
,
xE
,
cold
,
medium
,
hot
)))
val_path
=
gc
.
CreatePath
()
val_path
=
gc
.
CreatePath
()
val_path
.
MoveToPoint
(
x0
,
w1
)
val_path
.
MoveToPoint
(
x0
,
w1
)
...
@@ -328,7 +324,7 @@ class TempGauge(wx.Panel):
...
@@ -328,7 +324,7 @@ class TempGauge(wx.Panel):
val_path
.
AddLineToPoint
(
value
+
2
,
w1
+
width
/
4
)
val_path
.
AddLineToPoint
(
value
+
2
,
w1
+
width
/
4
)
val_path
.
AddLineToPoint
(
value
+
2
,
w2
-
width
/
4
)
val_path
.
AddLineToPoint
(
value
+
2
,
w2
-
width
/
4
)
val_path
.
AddLineToPoint
(
value
,
w2
)
val_path
.
AddLineToPoint
(
value
,
w2
)
#val_path.AddLineToPoint(value-4, 10)
#
val_path.AddLineToPoint(value-4, 10)
val_path
.
AddLineToPoint
(
x0
,
w2
)
val_path
.
AddLineToPoint
(
x0
,
w2
)
gc
.
DrawPath
(
val_path
)
gc
.
DrawPath
(
val_path
)
# draw setpoint markers
# draw setpoint markers
...
@@ -344,8 +340,8 @@ class TempGauge(wx.Panel):
...
@@ -344,8 +340,8 @@ class TempGauge(wx.Panel):
gc
.
DrawPath
(
setp_path
)
gc
.
DrawPath
(
setp_path
)
# draw readout
# draw readout
text
=
u"T
\u00B0
%
u/
%
u"
%
(
self
.
value
,
self
.
setpoint
)
text
=
u"T
\u00B0
%
u/
%
u"
%
(
self
.
value
,
self
.
setpoint
)
#gc.SetFont(gc.CreateFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD), wx.WHITE))
#
gc.SetFont(gc.CreateFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD), wx.WHITE))
#gc.DrawText(text, 29,-2)
#
gc.DrawText(text, 29,-2)
gc
.
SetFont
(
gc
.
CreateFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_BOLD
),
wx
.
WHITE
))
gc
.
SetFont
(
gc
.
CreateFont
(
wx
.
Font
(
10
,
wx
.
FONTFAMILY_DEFAULT
,
wx
.
FONTSTYLE_NORMAL
,
wx
.
FONTWEIGHT_BOLD
),
wx
.
WHITE
))
gc
.
DrawText
(
self
.
title
,
x0
+
19
,
y0
+
4
)
gc
.
DrawText
(
self
.
title
,
x0
+
19
,
y0
+
4
)
gc
.
DrawText
(
text
,
x0
+
119
,
y0
+
4
)
gc
.
DrawText
(
text
,
x0
+
119
,
y0
+
4
)
...
...
printrun/gui/xybuttons.py
View file @
d6bd9e75
...
@@ -281,9 +281,9 @@ class XYButtons(BufferedCanvas):
...
@@ -281,9 +281,9 @@ class XYButtons(BufferedCanvas):
# for idx, kpos in self.label_overlay_positions.items():
# for idx, kpos in self.label_overlay_positions.items():
# dc.DrawCircle(kpos[0], kpos[1], kpos[2])
# dc.DrawCircle(kpos[0], kpos[1], kpos[2])
#
# ------ #
#
#
------
#
#
# Events #
#
#
Events
#
#
# ------ #
#
#
------
#
def
OnTopLevelKey
(
self
,
evt
):
def
OnTopLevelKey
(
self
,
evt
):
# Let user press escape on any control, and return focus here
# Let user press escape on any control, and return focus here
if
evt
.
GetKeyCode
()
==
wx
.
WXK_ESCAPE
:
if
evt
.
GetKeyCode
()
==
wx
.
WXK_ESCAPE
:
...
...
printrun/gui/zbuttons.py
View file @
d6bd9e75
...
@@ -124,9 +124,9 @@ class ZButtons(BufferedCanvas):
...
@@ -124,9 +124,9 @@ class ZButtons(BufferedCanvas):
gc
.
SetBrush
(
wx
.
Brush
(
self
.
bgcolormask
))
gc
.
SetBrush
(
wx
.
Brush
(
self
.
bgcolormask
))
gc
.
DrawRectangle
(
0
,
0
,
w
,
h
)
gc
.
DrawRectangle
(
0
,
0
,
w
,
h
)
#
# ------ #
#
#
------
#
#
# Events #
#
#
Events
#
#
# ------ #
#
#
------
#
def
OnMotion
(
self
,
event
):
def
OnMotion
(
self
,
event
):
if
not
self
.
enabled
:
if
not
self
.
enabled
:
...
...
printrun/gviz.py
View file @
d6bd9e75
...
@@ -72,7 +72,7 @@ class GvizWindow(GvizBaseFrame):
...
@@ -72,7 +72,7 @@ class GvizWindow(GvizBaseFrame):
self
.
p
=
Gviz
(
panel
,
size
=
size
,
build_dimensions
=
build_dimensions
,
grid
=
grid
,
extrusion_width
=
extrusion_width
,
bgcolor
=
bgcolor
,
realparent
=
self
)
self
.
p
=
Gviz
(
panel
,
size
=
size
,
build_dimensions
=
build_dimensions
,
grid
=
grid
,
extrusion_width
=
extrusion_width
,
bgcolor
=
bgcolor
,
realparent
=
self
)
self
.
toolbar
.
AddSeparator
()
self
.
toolbar
.
AddSeparator
()
#self.toolbar.AddSimpleTool(6, wx.Image(imagefile('inject.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap(), _("Insert Code at start of this layer"), '')
#
self.toolbar.AddSimpleTool(6, wx.Image(imagefile('inject.png'), wx.BITMAP_TYPE_PNG).ConvertToBitmap(), _("Insert Code at start of this layer"), '')
self
.
toolbar
.
Realize
()
self
.
toolbar
.
Realize
()
vbox
.
Add
(
self
.
p
,
1
,
wx
.
EXPAND
)
vbox
.
Add
(
self
.
p
,
1
,
wx
.
EXPAND
)
...
@@ -82,7 +82,7 @@ class GvizWindow(GvizBaseFrame):
...
@@ -82,7 +82,7 @@ class GvizWindow(GvizBaseFrame):
self
.
Bind
(
wx
.
EVT_TOOL
,
lambda
x
:
self
.
p
.
layerup
(),
id
=
3
)
self
.
Bind
(
wx
.
EVT_TOOL
,
lambda
x
:
self
.
p
.
layerup
(),
id
=
3
)
self
.
Bind
(
wx
.
EVT_TOOL
,
lambda
x
:
self
.
p
.
layerdown
(),
id
=
4
)
self
.
Bind
(
wx
.
EVT_TOOL
,
lambda
x
:
self
.
p
.
layerdown
(),
id
=
4
)
self
.
Bind
(
wx
.
EVT_TOOL
,
self
.
resetview
,
id
=
5
)
self
.
Bind
(
wx
.
EVT_TOOL
,
self
.
resetview
,
id
=
5
)
#self.Bind(wx.EVT_TOOL, lambda x:self.p.inject(), id = 6)
#
self.Bind(wx.EVT_TOOL, lambda x:self.p.inject(), id = 6)
self
.
initpos
=
None
self
.
initpos
=
None
self
.
p
.
Bind
(
wx
.
EVT_KEY_DOWN
,
self
.
key
)
self
.
p
.
Bind
(
wx
.
EVT_KEY_DOWN
,
self
.
key
)
...
@@ -201,7 +201,7 @@ class Gviz(wx.Panel):
...
@@ -201,7 +201,7 @@ class Gviz(wx.Panel):
self
.
paint_overlay
=
None
self
.
paint_overlay
=
None
def
inject
(
self
):
def
inject
(
self
):
#import pdb; pdb.set_trace()
#
import pdb; pdb.set_trace()
print
"Inject code here..."
print
"Inject code here..."
print
"Layer "
+
str
(
self
.
layerindex
+
1
)
+
" - Z = "
+
str
(
self
.
get_currentz
())
+
" mm"
print
"Layer "
+
str
(
self
.
layerindex
+
1
)
+
" - Z = "
+
str
(
self
.
get_currentz
())
+
" mm"
...
...
printrun/packer.py
View file @
d6bd9e75
#
#
Imported from python-rectangle-packer commit 32fce1aaba
# Imported from python-rectangle-packer commit 32fce1aaba
#
#
https://github.com/maxretter/python-rectangle-packer
# https://github.com/maxretter/python-rectangle-packer
#
#
#
#
#
Python Rectangle Packer - Packs rectangles around a central point
# Python Rectangle Packer - Packs rectangles around a central point
#
#
Copyright (C) 2013 Max Retter
# Copyright (C) 2013 Max Retter
#
#
#
#
#
This program is free software: you can redistribute it and/or modify
# This program is free software: you can redistribute it and/or modify
#
#
it under the terms of the GNU General Public License as published by
# it under the terms of the GNU General Public License as published by
#
#
the Free Software Foundation, either version 3 of the License, or
# the Free Software Foundation, either version 3 of the License, or
#
#
(at your option) any later version.
# (at your option) any later version.
#
#
#
#
#
This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
#
#
but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#
#
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#
#
GNU General Public License for more details.
# GNU General Public License for more details.
#
#
#
#
#
You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
#
#
along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
math
import
math
...
@@ -67,7 +67,7 @@ class Rect(object):
...
@@ -67,7 +67,7 @@ class Rect(object):
self
.
height
=
height
self
.
height
=
height
self
.
data
=
data
self
.
data
=
data
#
#
upper left
# upper left
self
.
position
=
Vector2
()
self
.
position
=
Vector2
()
def
half
(
self
):
def
half
(
self
):
...
@@ -130,7 +130,7 @@ class PointList(object):
...
@@ -130,7 +130,7 @@ class PointList(object):
index
=
i
+
1
index
=
i
+
1
segs
.
append
(
LineSegment
(
segs
.
append
(
LineSegment
(
Vector2
(
self
.
points
[
index
-
1
][
0
],
self
.
points
[
index
-
1
][
1
]),
Vector2
(
self
.
points
[
index
-
1
][
0
],
self
.
points
[
index
-
1
][
1
]),
Vector2
(
self
.
points
[
index
][
0
],
self
.
points
[
index
][
1
])
Vector2
(
self
.
points
[
index
][
0
],
self
.
points
[
index
][
1
])
))
))
...
@@ -158,17 +158,17 @@ class LineSegment(object):
...
@@ -158,17 +158,17 @@ class LineSegment(object):
seg_mag
=
segment_vector
.
magnitude
()
seg_mag
=
segment_vector
.
magnitude
()
#
#
project point_vector on segment_vector
# project point_vector on segment_vector
projection
=
segment_vector
.
dot_product
(
point_vector
)
projection
=
segment_vector
.
dot_product
(
point_vector
)
#
#
scalar value used to interpolate new point along segment_vector
# scalar value used to interpolate new point along segment_vector
scalar
=
projection
/
seg_mag
**
2
scalar
=
projection
/
seg_mag
**
2
#
#
clamp on [0,1]
# clamp on [0,1]
scalar
=
1.0
if
scalar
>
1.0
else
scalar
scalar
=
1.0
if
scalar
>
1.0
else
scalar
scalar
=
0.0
if
scalar
<
0.0
else
scalar
scalar
=
0.0
if
scalar
<
0.0
else
scalar
#
#
interpolate scalar along segment and add start point back in
# interpolate scalar along segment and add start point back in
return
self
.
start
.
add
(
segment_vector
.
unit
()
.
scale
(
scalar
*
seg_mag
))
return
self
.
start
.
add
(
segment_vector
.
unit
()
.
scale
(
scalar
*
seg_mag
))
def
closest_distance_to_point
(
self
,
point
):
def
closest_distance_to_point
(
self
,
point
):
...
@@ -185,44 +185,44 @@ class Packer(object):
...
@@ -185,44 +185,44 @@ class Packer(object):
self
.
_rects
.
append
(
Rect
(
width
,
height
,
data
))
self
.
_rects
.
append
(
Rect
(
width
,
height
,
data
))
def
pack
(
self
,
padding
=
0
,
center
=
Vector2
()):
def
pack
(
self
,
padding
=
0
,
center
=
Vector2
()):
#
#
init everything
# init everything
placed_rects
=
[]
placed_rects
=
[]
sorted_rects
=
sorted
(
self
.
_rects
,
key
=
lambda
rect
:
-
rect
.
area
())
sorted_rects
=
sorted
(
self
.
_rects
,
key
=
lambda
rect
:
-
rect
.
area
())
#
#
double padding due to halfing later on
# double padding due to halfing later on
padding
*=
2
padding
*=
2
for
rect
in
sorted_rects
:
for
rect
in
sorted_rects
:
if
not
placed_rects
:
if
not
placed_rects
:
#
#
first rect, right on target.
# first rect, right on target.
rect
.
set_center
(
center
)
rect
.
set_center
(
center
)
else
:
else
:
#
#
Expand each rectangle based on new rect size and padding
# Expand each rectangle based on new rect size and padding
#
#
get a list of points
# get a list of points
#
#
build a polygon
# build a polygon
point_lists
=
[
point_lists
=
[
pr
.
expand
(
rect
.
width
+
padding
,
rect
.
height
+
padding
)
.
point_list
()
.
polygon
()
pr
.
expand
(
rect
.
width
+
padding
,
rect
.
height
+
padding
)
.
point_list
()
.
polygon
()
for
pr
in
placed_rects
for
pr
in
placed_rects
]
]
#
#
take the union of all the polygons (relies on + operator override)
# take the union of all the polygons (relies on + operator override)
#
#
the [0] at the end returns the first "contour", which is the only one we need
# the [0] at the end returns the first "contour", which is the only one we need
bounding_points
=
PointList
(
sum
(
bounding_points
=
PointList
(
sum
(
point_lists
[
1
:],
point_lists
[
1
:],
point_lists
[
0
]
point_lists
[
0
]
)[
0
])
)[
0
])
#
#
find the closest segment
# find the closest segment
closest_segments
=
sorted
(
closest_segments
=
sorted
(
bounding_points
.
segments
(),
bounding_points
.
segments
(),
key
=
lambda
segment
:
segment
.
closest_distance_to_point
(
center
)
key
=
lambda
segment
:
segment
.
closest_distance_to_point
(
center
)
)
)
#
#
get the closest point
# get the closest point
place_point
=
closest_segments
[
0
]
.
closest_point_to_point
(
center
)
place_point
=
closest_segments
[
0
]
.
closest_point_to_point
(
center
)
#
#
set the rect position
# set the rect position
rect
.
set_center
(
place_point
)
rect
.
set_center
(
place_point
)
placed_rects
.
append
(
rect
)
placed_rects
.
append
(
rect
)
...
...
printrun/pronterface.py
View file @
d6bd9e75
...
@@ -177,7 +177,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -177,7 +177,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
display_graph
=
self
.
settings
.
tempgraph
self
.
display_graph
=
self
.
settings
.
tempgraph
self
.
display_gauges
=
self
.
settings
.
tempgauges
self
.
display_gauges
=
self
.
settings
.
tempgauges
#set feedrates in printcore for pause/resume
#
set feedrates in printcore for pause/resume
self
.
p
.
xy_feedrate
=
self
.
settings
.
xy_feedrate
self
.
p
.
xy_feedrate
=
self
.
settings
.
xy_feedrate
self
.
p
.
z_feedrate
=
self
.
settings
.
z_feedrate
self
.
p
.
z_feedrate
=
self
.
settings
.
z_feedrate
...
@@ -361,7 +361,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -361,7 +361,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def
do_settemp
(
self
,
l
=
""
):
def
do_settemp
(
self
,
l
=
""
):
try
:
try
:
if
not
l
.
__class__
in
(
str
,
unicode
)
or
not
len
(
l
):
if
l
.
__class__
not
in
(
str
,
unicode
)
or
not
len
(
l
):
l
=
str
(
self
.
htemp
.
GetValue
()
.
split
()[
0
])
l
=
str
(
self
.
htemp
.
GetValue
()
.
split
()[
0
])
l
=
l
.
lower
()
.
replace
(
", "
,
"."
)
l
=
l
.
lower
()
.
replace
(
", "
,
"."
)
for
i
in
self
.
temps
.
keys
():
for
i
in
self
.
temps
.
keys
():
...
@@ -381,7 +381,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -381,7 +381,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def
do_bedtemp
(
self
,
l
=
""
):
def
do_bedtemp
(
self
,
l
=
""
):
try
:
try
:
if
not
l
.
__class__
in
(
str
,
unicode
)
or
not
len
(
l
):
if
l
.
__class__
not
in
(
str
,
unicode
)
or
not
len
(
l
):
l
=
str
(
self
.
btemp
.
GetValue
()
.
split
()[
0
])
l
=
str
(
self
.
btemp
.
GetValue
()
.
split
()[
0
])
l
=
l
.
lower
()
.
replace
(
", "
,
"."
)
l
=
l
.
lower
()
.
replace
(
", "
,
"."
)
for
i
in
self
.
bedtemps
.
keys
():
for
i
in
self
.
bedtemps
.
keys
():
...
@@ -401,7 +401,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -401,7 +401,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def
do_setspeed
(
self
,
l
=
""
):
def
do_setspeed
(
self
,
l
=
""
):
try
:
try
:
if
not
l
.
__class__
in
(
str
,
unicode
)
or
not
len
(
l
):
if
l
.
__class__
not
in
(
str
,
unicode
)
or
not
len
(
l
):
l
=
str
(
self
.
speed_slider
.
GetValue
())
l
=
str
(
self
.
speed_slider
.
GetValue
())
else
:
else
:
l
=
l
.
lower
()
l
=
l
.
lower
()
...
@@ -1175,7 +1175,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1175,7 +1175,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self
.
p
.
pause
()
self
.
p
.
pause
()
self
.
p
.
runSmallScript
(
self
.
pauseScript
)
self
.
p
.
runSmallScript
(
self
.
pauseScript
)
self
.
paused
=
True
self
.
paused
=
True
#self.p.runSmallScript(self.pauseScript)
#
self.p.runSmallScript(self.pauseScript)
self
.
extra_print_time
+=
int
(
time
.
time
()
-
self
.
starttime
)
self
.
extra_print_time
+=
int
(
time
.
time
()
-
self
.
starttime
)
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Resume"
))
wx
.
CallAfter
(
self
.
pausebtn
.
SetLabel
,
_
(
"Resume"
))
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
wx
.
CallAfter
(
self
.
toolbarsizer
.
Layout
)
...
@@ -1213,7 +1213,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1213,7 +1213,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self
.
recvlisteners
.
append
(
self
.
waitforsdresponse
)
self
.
recvlisteners
.
append
(
self
.
waitforsdresponse
)
self
.
p
.
send_now
(
"M23 "
+
target
.
lower
())
self
.
p
.
send_now
(
"M23 "
+
target
.
lower
())
dlg
.
Destroy
()
dlg
.
Destroy
()
#print self.sdfiles
#
print self.sdfiles
def
getfiles
(
self
):
def
getfiles
(
self
):
if
not
self
.
p
.
online
:
if
not
self
.
p
.
online
:
...
@@ -1695,7 +1695,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1695,7 +1695,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self
.
endcb
()
self
.
endcb
()
return
return
if
"SD printing byte"
in
l
:
if
"SD printing byte"
in
l
:
#M27 handler
#
M27 handler
try
:
try
:
resp
=
l
.
split
()
resp
=
l
.
split
()
vals
=
resp
[
-
1
]
.
split
(
"/"
)
vals
=
resp
[
-
1
]
.
split
(
"/"
)
...
@@ -1718,7 +1718,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1718,7 +1718,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
if
btndef
is
None
:
if
btndef
is
None
:
if
i
==
len
(
custombuttons
)
-
1
:
if
i
==
len
(
custombuttons
)
-
1
:
self
.
newbuttonbutton
=
b
=
wx
.
Button
(
self
.
centerpanel
,
-
1
,
"+"
,
size
=
(
19
,
18
),
style
=
wx
.
BU_EXACTFIT
)
self
.
newbuttonbutton
=
b
=
wx
.
Button
(
self
.
centerpanel
,
-
1
,
"+"
,
size
=
(
19
,
18
),
style
=
wx
.
BU_EXACTFIT
)
#b.SetFont(wx.Font(12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
#
b.SetFont(wx.Font(12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
b
.
SetForegroundColour
(
"#4444ff"
)
b
.
SetForegroundColour
(
"#4444ff"
)
b
.
SetToolTip
(
wx
.
ToolTip
(
_
(
"click to add new custom button"
)))
b
.
SetToolTip
(
wx
.
ToolTip
(
_
(
"click to add new custom button"
)))
b
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
cbutton_edit
)
b
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
cbutton_edit
)
...
@@ -1755,7 +1755,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1755,7 +1755,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
return
rest
[
1
:]
.
split
(
'"'
,
1
)
return
rest
[
1
:]
.
split
(
'"'
,
1
)
else
:
else
:
return
rest
.
split
(
None
,
1
)
return
rest
.
split
(
None
,
1
)
#try:
#
try:
num
,
argstr
=
nextarg
(
argstr
)
num
,
argstr
=
nextarg
(
argstr
)
num
=
int
(
num
)
num
=
int
(
num
)
title
,
argstr
=
nextarg
(
argstr
)
title
,
argstr
=
nextarg
(
argstr
)
...
@@ -1777,7 +1777,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1777,7 +1777,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self
.
custombuttons
[
num
]
.
background
=
colour
self
.
custombuttons
[
num
]
.
background
=
colour
if
not
self
.
processing_rc
:
if
not
self
.
processing_rc
:
self
.
cbuttons_reload
()
self
.
cbuttons_reload
()
#except Exception, x:
#
except Exception, x:
# print "Bad syntax for button definition, see 'help button'"
# print "Bad syntax for button definition, see 'help button'"
# print x
# print x
...
@@ -1788,7 +1788,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1788,7 +1788,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
elif
bdef
.
background
:
elif
bdef
.
background
:
colour
=
bdef
.
background
colour
=
bdef
.
background
if
type
(
colour
)
not
in
(
str
,
unicode
):
if
type
(
colour
)
not
in
(
str
,
unicode
):
#print type(colour), map(type, colour)
#
print type(colour), map(type, colour)
if
type
(
colour
)
==
tuple
and
tuple
(
map
(
type
,
colour
))
==
(
int
,
int
,
int
):
if
type
(
colour
)
==
tuple
and
tuple
(
map
(
type
,
colour
))
==
(
int
,
int
,
int
):
colour
=
map
(
lambda
x
:
x
%
256
,
colour
)
colour
=
map
(
lambda
x
:
x
%
256
,
colour
)
colour
=
wx
.
Colour
(
*
colour
)
.
GetAsString
(
wx
.
C2S_NAME
|
wx
.
C2S_HTML_SYNTAX
)
colour
=
wx
.
Colour
(
*
colour
)
.
GetAsString
(
wx
.
C2S_NAME
|
wx
.
C2S_HTML_SYNTAX
)
...
@@ -1807,7 +1807,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1807,7 +1807,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
if
button
.
properties
.
background
:
if
button
.
properties
.
background
:
colour
=
button
.
properties
.
background
colour
=
button
.
properties
.
background
if
type
(
colour
)
not
in
(
str
,
unicode
):
if
type
(
colour
)
not
in
(
str
,
unicode
):
#print type(colour)
#
print type(colour)
if
type
(
colour
)
==
tuple
and
tuple
(
map
(
type
,
colour
))
==
(
int
,
int
,
int
):
if
type
(
colour
)
==
tuple
and
tuple
(
map
(
type
,
colour
))
==
(
int
,
int
,
int
):
colour
=
map
(
lambda
x
:
x
%
256
,
colour
)
colour
=
map
(
lambda
x
:
x
%
256
,
colour
)
colour
=
wx
.
Colour
(
*
colour
)
.
GetAsString
(
wx
.
C2S_NAME
|
wx
.
C2S_HTML_SYNTAX
)
colour
=
wx
.
Colour
(
*
colour
)
.
GetAsString
(
wx
.
C2S_NAME
|
wx
.
C2S_HTML_SYNTAX
)
...
@@ -1846,7 +1846,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1846,7 +1846,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self
.
custombuttons
[
n
],
self
.
custombuttons
[
n
+
1
]
=
self
.
custombuttons
[
n
+
1
],
self
.
custombuttons
[
n
]
self
.
custombuttons
[
n
],
self
.
custombuttons
[
n
+
1
]
=
self
.
custombuttons
[
n
+
1
],
self
.
custombuttons
[
n
]
self
.
cbutton_save
(
n
,
self
.
custombuttons
[
n
])
self
.
cbutton_save
(
n
,
self
.
custombuttons
[
n
])
self
.
cbutton_save
(
n
+
1
,
self
.
custombuttons
[
n
+
1
])
self
.
cbutton_save
(
n
+
1
,
self
.
custombuttons
[
n
+
1
])
#if self.custombuttons[-1] is None:
#
if self.custombuttons[-1] is None:
# del self.custombuttons[-1]
# del self.custombuttons[-1]
wx
.
CallAfter
(
self
.
cbuttons_reload
)
wx
.
CallAfter
(
self
.
cbuttons_reload
)
...
@@ -1889,15 +1889,15 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1889,15 +1889,15 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
if
not
hasattr
(
self
,
"dragging"
):
if
not
hasattr
(
self
,
"dragging"
):
# init dragging of the custom button
# init dragging of the custom button
if
hasattr
(
obj
,
"custombutton"
)
and
obj
.
properties
is
not
None
:
if
hasattr
(
obj
,
"custombutton"
)
and
obj
.
properties
is
not
None
:
#self.newbuttonbutton.SetLabel("")
#
self.newbuttonbutton.SetLabel("")
#self.newbuttonbutton.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
#
self.newbuttonbutton.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
#self.newbuttonbutton.SetForegroundColour("black")
#
self.newbuttonbutton.SetForegroundColour("black")
#self.newbuttonbutton.SetSize(obj.GetSize())
#
self.newbuttonbutton.SetSize(obj.GetSize())
#if self.toolbarsizer.GetItem(self.newbuttonbutton) is not None:
#
if self.toolbarsizer.GetItem(self.newbuttonbutton) is not None:
# self.toolbarsizer.SetItemMinSize(self.newbuttonbutton, obj.GetSize())
# self.toolbarsizer.SetItemMinSize(self.newbuttonbutton, obj.GetSize())
# self.mainsizer.Layout()
# self.mainsizer.Layout()
for
b
in
self
.
custombuttons_widgets
:
for
b
in
self
.
custombuttons_widgets
:
#if b.IsFrozen(): b.Thaw()
#
if b.IsFrozen(): b.Thaw()
if
b
.
properties
is
None
:
if
b
.
properties
is
None
:
b
.
Enable
()
b
.
Enable
()
b
.
SetLabel
(
""
)
b
.
SetLabel
(
""
)
...
@@ -1930,7 +1930,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1930,7 +1930,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
if
b
.
GetScreenRect
()
.
Contains
(
scrpos
):
if
b
.
GetScreenRect
()
.
Contains
(
scrpos
):
dst
=
b
dst
=
b
break
break
#if dst is None and self.panel.GetScreenRect().Contains(scrpos):
#
if dst is None and self.panel.GetScreenRect().Contains(scrpos):
# # try to check if it is after buttons at the end
# # try to check if it is after buttons at the end
# tspos = self.panel.ClientToScreen(self.toolbarsizer.GetPosition())
# tspos = self.panel.ClientToScreen(self.toolbarsizer.GetPosition())
# bspos = self.panel.ClientToScreen(self.cbuttonssizer.GetPosition())
# bspos = self.panel.ClientToScreen(self.cbuttonssizer.GetPosition())
...
@@ -2047,7 +2047,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -2047,7 +2047,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
hbox
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
hbox
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
okb
=
wx
.
Button
(
dialog
,
wx
.
ID_OK
,
_
(
"Ok"
),
size
=
(
60
,
24
))
okb
=
wx
.
Button
(
dialog
,
wx
.
ID_OK
,
_
(
"Ok"
),
size
=
(
60
,
24
))
dialog
.
Bind
(
wx
.
EVT_TEXT_ENTER
,
lambda
e
:
dialog
.
EndModal
(
wx
.
ID_OK
),
dialog
.
namectrl
)
dialog
.
Bind
(
wx
.
EVT_TEXT_ENTER
,
lambda
e
:
dialog
.
EndModal
(
wx
.
ID_OK
),
dialog
.
namectrl
)
#dialog.Bind(wx.EVT_BUTTON, lambda e:self.new_macro_named(dialog, e), okb)
#
dialog.Bind(wx.EVT_BUTTON, lambda e:self.new_macro_named(dialog, e), okb)
hbox
.
Add
(
okb
)
hbox
.
Add
(
okb
)
hbox
.
Add
(
wx
.
Button
(
dialog
,
wx
.
ID_CANCEL
,
_
(
"Cancel"
),
size
=
(
60
,
24
)))
hbox
.
Add
(
wx
.
Button
(
dialog
,
wx
.
ID_CANCEL
,
_
(
"Cancel"
),
size
=
(
60
,
24
)))
vbox
.
Add
(
panel
)
vbox
.
Add
(
panel
)
...
...
printrun/stlplater.py
View file @
d6bd9e75
...
@@ -127,28 +127,28 @@ class showstl(wx.Window):
...
@@ -127,28 +127,28 @@ class showstl(wx.Window):
def
keypress
(
self
,
event
):
def
keypress
(
self
,
event
):
"""gets keypress events and moves/rotates acive shape"""
"""gets keypress events and moves/rotates acive shape"""
keycode
=
event
.
GetKeyCode
()
keycode
=
event
.
GetKeyCode
()
#print keycode
#
print keycode
step
=
5
step
=
5
angle
=
18
angle
=
18
if
event
.
ControlDown
():
if
event
.
ControlDown
():
step
=
1
step
=
1
angle
=
1
angle
=
1
#h
#
h
if
keycode
==
72
:
if
keycode
==
72
:
self
.
move_shape
((
-
step
,
0
))
self
.
move_shape
((
-
step
,
0
))
#l
#
l
if
keycode
==
76
:
if
keycode
==
76
:
self
.
move_shape
((
step
,
0
))
self
.
move_shape
((
step
,
0
))
#j
#
j
if
keycode
==
75
:
if
keycode
==
75
:
self
.
move_shape
((
0
,
step
))
self
.
move_shape
((
0
,
step
))
#k
#
k
if
keycode
==
74
:
if
keycode
==
74
:
self
.
move_shape
((
0
,
-
step
))
self
.
move_shape
((
0
,
-
step
))
#[
#
[
if
keycode
==
91
:
if
keycode
==
91
:
self
.
rotate_shape
(
-
angle
)
self
.
rotate_shape
(
-
angle
)
#]
#
]
if
keycode
==
93
:
if
keycode
==
93
:
self
.
rotate_shape
(
angle
)
self
.
rotate_shape
(
angle
)
event
.
Skip
()
event
.
Skip
()
...
@@ -297,7 +297,7 @@ class StlPlater(Plater):
...
@@ -297,7 +297,7 @@ class StlPlater(Plater):
self
.
s
.
drawmodel
(
newmodel
,
2
)
self
.
s
.
drawmodel
(
newmodel
,
2
)
break
break
else
:
else
:
#Filter out the path, just show the STL filename.
#
Filter out the path, just show the STL filename.
self
.
load_stl_into_model
(
name
,
name
)
self
.
load_stl_into_model
(
name
,
name
)
self
.
Refresh
()
self
.
Refresh
()
...
@@ -402,4 +402,4 @@ class StlPlater(Plater):
...
@@ -402,4 +402,4 @@ class StlPlater(Plater):
del
models
[
name
]
del
models
[
name
]
break
break
if
p
.
wait
()
!=
0
:
if
p
.
wait
()
!=
0
:
raise
RuntimeError
,
_
(
"simarrange failed"
)
raise
RuntimeError
(
_
(
"simarrange failed"
)
)
printrun/stltool.py
View file @
d6bd9e75
...
@@ -39,14 +39,14 @@ I = [
...
@@ -39,14 +39,14 @@ I = [
def
transpose
(
matrix
):
def
transpose
(
matrix
):
return
zip
(
*
matrix
)
return
zip
(
*
matrix
)
#return [[v[i] for v in matrix] for i in xrange(len(matrix[0]))]
#
return [[v[i] for v in matrix] for i in xrange(len(matrix[0]))]
def
multmatrix
(
vector
,
matrix
):
def
multmatrix
(
vector
,
matrix
):
return
map
(
sum
,
transpose
(
map
(
lambda
x
:
[
x
[
0
]
*
p
for
p
in
x
[
1
]],
zip
(
vector
,
transpose
(
matrix
)))))
return
map
(
sum
,
transpose
(
map
(
lambda
x
:
[
x
[
0
]
*
p
for
p
in
x
[
1
]],
zip
(
vector
,
transpose
(
matrix
)))))
def
applymatrix
(
facet
,
matrix
=
I
):
def
applymatrix
(
facet
,
matrix
=
I
):
#return facet
#
return facet
#return [map(lambda x:-1.0*x, multmatrix(facet[0]+[1], matrix)[:3]), map(lambda x:multmatrix(x+[1], matrix)[:3], facet[1])]
#
return [map(lambda x:-1.0*x, multmatrix(facet[0]+[1], matrix)[:3]), map(lambda x:multmatrix(x+[1], matrix)[:3], facet[1])]
return
genfacet
(
map
(
lambda
x
:
multmatrix
(
x
+
[
1
],
matrix
)[:
3
],
facet
[
1
]))
return
genfacet
(
map
(
lambda
x
:
multmatrix
(
x
+
[
1
],
matrix
)[:
3
],
facet
[
1
]))
f
=
[[
0
,
0
,
0
],
[[
-
3.022642
,
0.642482
,
-
9.510565
],
[
-
3.022642
,
0.642482
,
-
9.510565
],
[
-
3.022642
,
0.642482
,
-
9.510565
]]]
f
=
[[
0
,
0
,
0
],
[[
-
3.022642
,
0.642482
,
-
9.510565
],
[
-
3.022642
,
0.642482
,
-
9.510565
],
[
-
3.022642
,
0.642482
,
-
9.510565
]]]
...
@@ -70,7 +70,7 @@ def emitstl(filename, facets = [], objname = "stltool_export", binary = 1):
...
@@ -70,7 +70,7 @@ def emitstl(filename, facets = [], objname = "stltool_export", binary = 1):
for
j
in
i
[
1
]:
for
j
in
i
[
1
]:
l
+=
j
[:]
l
+=
j
[:]
l
+=
[
0
]
l
+=
[
0
]
#print len(l)
#
print len(l)
buf
+=
facetformat
.
pack
(
*
l
)
buf
+=
facetformat
.
pack
(
*
l
)
f
.
write
(
buf
)
f
.
write
(
buf
)
f
.
close
()
f
.
close
()
...
@@ -204,7 +204,7 @@ class stl(object):
...
@@ -204,7 +204,7 @@ class stl(object):
if
l
.
startswith
(
"solid"
):
if
l
.
startswith
(
"solid"
):
self
.
insolid
=
1
self
.
insolid
=
1
self
.
name
=
l
[
6
:]
self
.
name
=
l
[
6
:]
#print self.name
#
print self.name
elif
l
.
startswith
(
"endsolid"
):
elif
l
.
startswith
(
"endsolid"
):
self
.
insolid
=
0
self
.
insolid
=
0
...
@@ -244,4 +244,4 @@ if __name__ == "__main__":
...
@@ -244,4 +244,4 @@ if __name__ == "__main__":
print
i
,
len
(
working
)
print
i
,
len
(
working
)
emitstl
(
"../../Downloads/frame-vertex-neo-foot-x4-a.stl"
,
s
.
facets
,
"emitted_object"
)
emitstl
(
"../../Downloads/frame-vertex-neo-foot-x4-a.stl"
,
s
.
facets
,
"emitted_object"
)
#stl("../prusamendel/stl/mendelplate.stl")
#
stl("../prusamendel/stl/mendelplate.stl")
printrun/stlview.py
View file @
d6bd9e75
...
@@ -21,11 +21,17 @@ import time
...
@@ -21,11 +21,17 @@ import time
import
pyglet
import
pyglet
pyglet
.
options
[
'debug_gl'
]
=
True
pyglet
.
options
[
'debug_gl'
]
=
True
from
pyglet.gl
import
*
from
pyglet.gl
import
GL_AMBIENT_AND_DIFFUSE
,
glBegin
,
glClearColor
,
\
glColor3f
,
GL_CULL_FACE
,
GL_DEPTH_TEST
,
GL_DIFFUSE
,
GL_EMISSION
,
\
glEnable
,
glEnd
,
GL_FILL
,
GLfloat
,
GL_FRONT_AND_BACK
,
GL_LIGHT0
,
\
GL_LIGHT1
,
glLightfv
,
GL_LIGHTING
,
GL_LINE
,
glMaterialf
,
glMaterialfv
,
\
glMultMatrixd
,
glNormal3f
,
glPolygonMode
,
glPopMatrix
,
GL_POSITION
,
\
glPushMatrix
,
glRotatef
,
glScalef
,
glShadeModel
,
GL_SHININESS
,
\
GL_SMOOTH
,
GL_SPECULAR
,
glTranslatef
,
GL_TRIANGLES
,
glVertex3f
from
pyglet
import
gl
from
pyglet
import
gl
from
.gl.panel
import
wxGLPanel
from
.gl.panel
import
wxGLPanel
from
.gl.trackball
import
trackball
,
mulquat
,
build_rotmatrix
from
.gl.trackball
import
build_rotmatrix
from
.gl.libtatlin
import
actors
from
.gl.libtatlin
import
actors
def
vec
(
*
args
):
def
vec
(
*
args
):
...
@@ -44,7 +50,7 @@ class stlview(object):
...
@@ -44,7 +50,7 @@ class stlview(object):
# Create a list of triangle indices.
# Create a list of triangle indices.
indices
=
range
(
3
*
len
(
facets
))
# [[3*i, 3*i+1, 3*i+2] for i in xrange(len(facets))]
indices
=
range
(
3
*
len
(
facets
))
# [[3*i, 3*i+1, 3*i+2] for i in xrange(len(facets))]
#print indices[:10]
#
print indices[:10]
self
.
vertex_list
=
batch
.
add_indexed
(
len
(
vertices
)
//
3
,
self
.
vertex_list
=
batch
.
add_indexed
(
len
(
vertices
)
//
3
,
GL_TRIANGLES
,
GL_TRIANGLES
,
None
,
# group,
None
,
# group,
...
@@ -87,25 +93,25 @@ class StlViewPanel(wxGLPanel):
...
@@ -87,25 +93,25 @@ class StlViewPanel(wxGLPanel):
self
.
mview_initialized
=
False
self
.
mview_initialized
=
False
super
(
StlViewPanel
,
self
)
.
OnReshape
()
super
(
StlViewPanel
,
self
)
.
OnReshape
()
#==========================================================================
#
==========================================================================
# GLFrame OpenGL Event Handlers
# GLFrame OpenGL Event Handlers
#==========================================================================
#
==========================================================================
def
OnInitGL
(
self
,
call_reshape
=
True
):
def
OnInitGL
(
self
,
call_reshape
=
True
):
'''Initialize OpenGL for use in the window.'''
'''Initialize OpenGL for use in the window.'''
if
self
.
GLinitialized
:
if
self
.
GLinitialized
:
return
return
self
.
GLinitialized
=
True
self
.
GLinitialized
=
True
#create a pyglet context for this panel
#
create a pyglet context for this panel
self
.
pygletcontext
=
gl
.
Context
(
gl
.
current_context
)
self
.
pygletcontext
=
gl
.
Context
(
gl
.
current_context
)
self
.
pygletcontext
.
canvas
=
self
self
.
pygletcontext
.
canvas
=
self
self
.
pygletcontext
.
set_current
()
self
.
pygletcontext
.
set_current
()
#normal gl init
#
normal gl init
glClearColor
(
0
,
0
,
0
,
1
)
glClearColor
(
0
,
0
,
0
,
1
)
glColor3f
(
1
,
0
,
0
)
glColor3f
(
1
,
0
,
0
)
glEnable
(
GL_DEPTH_TEST
)
glEnable
(
GL_DEPTH_TEST
)
glEnable
(
GL_CULL_FACE
)
glEnable
(
GL_CULL_FACE
)
# Uncomment this line for a wireframe view
# Uncomment this line for a wireframe view
#glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
#
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
# Simple light setup. On Windows GL_LIGHT0 is enabled by default,
# Simple light setup. On Windows GL_LIGHT0 is enabled by default,
# but this is not the case on Linux or Mac, so remember to always
# but this is not the case on Linux or Mac, so remember to always
...
@@ -202,22 +208,22 @@ class StlViewPanel(wxGLPanel):
...
@@ -202,22 +208,22 @@ class StlViewPanel(wxGLPanel):
if
event
.
ControlDown
():
if
event
.
ControlDown
():
step
=
1
step
=
1
angle
=
1
angle
=
1
#h
#
h
if
keycode
==
72
:
if
keycode
==
72
:
self
.
parent
.
move_shape
((
-
step
,
0
))
self
.
parent
.
move_shape
((
-
step
,
0
))
#l
#
l
if
keycode
==
76
:
if
keycode
==
76
:
self
.
parent
.
move_shape
((
step
,
0
))
self
.
parent
.
move_shape
((
step
,
0
))
#j
#
j
if
keycode
==
75
:
if
keycode
==
75
:
self
.
parent
.
move_shape
((
0
,
step
))
self
.
parent
.
move_shape
((
0
,
step
))
#k
#
k
if
keycode
==
74
:
if
keycode
==
74
:
self
.
parent
.
move_shape
((
0
,
-
step
))
self
.
parent
.
move_shape
((
0
,
-
step
))
#[
#
[
if
keycode
==
91
:
if
keycode
==
91
:
self
.
parent
.
rotate_shape
(
-
angle
)
self
.
parent
.
rotate_shape
(
-
angle
)
#]
#
]
if
keycode
==
93
:
if
keycode
==
93
:
self
.
parent
.
rotate_shape
(
angle
)
self
.
parent
.
rotate_shape
(
angle
)
event
.
Skip
()
event
.
Skip
()
...
@@ -235,7 +241,7 @@ class StlViewPanel(wxGLPanel):
...
@@ -235,7 +241,7 @@ class StlViewPanel(wxGLPanel):
v
+=
g
*
dt
v
+=
g
*
dt
if
obj
.
offsets
[
2
]
<
0
:
if
obj
.
offsets
[
2
]
<
0
:
obj
.
scale
[
2
]
*=
1
-
3
*
dt
obj
.
scale
[
2
]
*=
1
-
3
*
dt
#return
#
return
v
=
v
/
4
v
=
v
/
4
while
obj
.
offsets
[
2
]
<
basepos
:
while
obj
.
offsets
[
2
]
<
basepos
:
time
.
sleep
(
dt
)
time
.
sleep
(
dt
)
...
@@ -256,8 +262,8 @@ class StlViewPanel(wxGLPanel):
...
@@ -256,8 +262,8 @@ class StlViewPanel(wxGLPanel):
stlview
(
m
.
facets
,
batch
=
batch
)
stlview
(
m
.
facets
,
batch
=
batch
)
m
.
batch
=
batch
m
.
batch
=
batch
m
.
animoffset
=
300
m
.
animoffset
=
300
#print m
#
print m
#threading.Thread(target = self.anim, args = (m, )).start()
#
threading.Thread(target = self.anim, args = (m, )).start()
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
def
update_object_resize
(
self
):
def
update_object_resize
(
self
):
...
...
printrun/zscaper.py
View file @
d6bd9e75
...
@@ -22,11 +22,11 @@ def genscape(data = [[0, 1, 0, 0], [1, 0, 2, 0], [1, 0, 0, 0], [0, 1, 0, 1]],
...
@@ -22,11 +22,11 @@ def genscape(data = [[0, 1, 0, 0], [1, 0, 2, 0], [1, 0, 0, 0], [0, 1, 0, 1]],
o
=
stl
(
None
)
o
=
stl
(
None
)
datal
=
len
(
data
)
datal
=
len
(
data
)
datah
=
len
(
data
[
0
])
datah
=
len
(
data
[
0
])
#create bottom:
#
create bottom:
bmidpoint
=
(
pscale
*
(
datal
-
1
)
/
2.0
,
pscale
*
(
datah
-
1
)
/
2.0
)
bmidpoint
=
(
pscale
*
(
datal
-
1
)
/
2.0
,
pscale
*
(
datah
-
1
)
/
2.0
)
#print range(datal), bmidpoint
#
print range(datal), bmidpoint
for
i
in
zip
(
range
(
datal
+
1
)[:
-
1
],
range
(
datal
+
1
)[
1
:])[:
-
1
]:
for
i
in
zip
(
range
(
datal
+
1
)[:
-
1
],
range
(
datal
+
1
)[
1
:])[:
-
1
]:
#print (pscale*i[0], pscale*i[1])
#
print (pscale*i[0], pscale*i[1])
o
.
facets
+=
[[[
0
,
0
,
-
1
],
[[
0.0
,
pscale
*
i
[
0
],
0.0
],
[
0.0
,
pscale
*
i
[
1
],
0.0
],
[
bmidpoint
[
0
],
bmidpoint
[
1
],
0.0
]]]]
o
.
facets
+=
[[[
0
,
0
,
-
1
],
[[
0.0
,
pscale
*
i
[
0
],
0.0
],
[
0.0
,
pscale
*
i
[
1
],
0.0
],
[
bmidpoint
[
0
],
bmidpoint
[
1
],
0.0
]]]]
o
.
facets
+=
[[[
0
,
0
,
-
1
],
[[
2.0
*
bmidpoint
[
1
],
pscale
*
i
[
1
],
0.0
],
[
2.0
*
bmidpoint
[
1
],
pscale
*
i
[
0
],
0.0
],
[
bmidpoint
[
0
],
bmidpoint
[
1
],
0.0
]]]]
o
.
facets
+=
[[[
0
,
0
,
-
1
],
[[
2.0
*
bmidpoint
[
1
],
pscale
*
i
[
1
],
0.0
],
[
2.0
*
bmidpoint
[
1
],
pscale
*
i
[
0
],
0.0
],
[
bmidpoint
[
0
],
bmidpoint
[
1
],
0.0
]]]]
o
.
facets
+=
[
genfacet
([[
0.0
,
pscale
*
i
[
0
],
data
[
i
[
0
]][
0
]
*
zscale
+
bheight
],
[
0.0
,
pscale
*
i
[
1
],
data
[
i
[
1
]][
0
]
*
zscale
+
bheight
],
[
0.0
,
pscale
*
i
[
1
],
0.0
]])]
o
.
facets
+=
[
genfacet
([[
0.0
,
pscale
*
i
[
0
],
data
[
i
[
0
]][
0
]
*
zscale
+
bheight
],
[
0.0
,
pscale
*
i
[
1
],
data
[
i
[
1
]][
0
]
*
zscale
+
bheight
],
[
0.0
,
pscale
*
i
[
1
],
0.0
]])]
...
@@ -34,7 +34,7 @@ def genscape(data = [[0, 1, 0, 0], [1, 0, 2, 0], [1, 0, 0, 0], [0, 1, 0, 1]],
...
@@ -34,7 +34,7 @@ def genscape(data = [[0, 1, 0, 0], [1, 0, 2, 0], [1, 0, 0, 0], [0, 1, 0, 1]],
o
.
facets
+=
[
genfacet
([[
0.0
,
pscale
*
i
[
0
],
data
[
i
[
0
]][
0
]
*
zscale
+
bheight
],
[
0.0
,
pscale
*
i
[
1
],
0.0
],
[
0.0
,
pscale
*
i
[
0
],
0.0
]])]
o
.
facets
+=
[
genfacet
([[
0.0
,
pscale
*
i
[
0
],
data
[
i
[
0
]][
0
]
*
zscale
+
bheight
],
[
0.0
,
pscale
*
i
[
1
],
0.0
],
[
0.0
,
pscale
*
i
[
0
],
0.0
]])]
o
.
facets
+=
[
genfacet
([[
2.0
*
bmidpoint
[
1
],
pscale
*
i
[
1
],
0.0
],
[
2.0
*
bmidpoint
[
1
],
pscale
*
i
[
0
],
data
[
i
[
0
]][
datah
-
1
]
*
zscale
+
bheight
],
[
2.0
*
bmidpoint
[
1
],
pscale
*
i
[
0
],
0.0
]])]
o
.
facets
+=
[
genfacet
([[
2.0
*
bmidpoint
[
1
],
pscale
*
i
[
1
],
0.0
],
[
2.0
*
bmidpoint
[
1
],
pscale
*
i
[
0
],
data
[
i
[
0
]][
datah
-
1
]
*
zscale
+
bheight
],
[
2.0
*
bmidpoint
[
1
],
pscale
*
i
[
0
],
0.0
]])]
for
i
in
zip
(
range
(
datah
+
1
)[:
-
1
],
range
(
datah
+
1
)[
1
:])[:
-
1
]:
for
i
in
zip
(
range
(
datah
+
1
)[:
-
1
],
range
(
datah
+
1
)[
1
:])[:
-
1
]:
#print (pscale * i[0], pscale * i[1])
#
print (pscale * i[0], pscale * i[1])
o
.
facets
+=
[[[
0
,
0
,
-
1
],
[[
pscale
*
i
[
1
],
0.0
,
0.0
],
[
pscale
*
i
[
0
],
0.0
,
0.0
],
[
bmidpoint
[
0
],
bmidpoint
[
1
],
0.0
]]]]
o
.
facets
+=
[[[
0
,
0
,
-
1
],
[[
pscale
*
i
[
1
],
0.0
,
0.0
],
[
pscale
*
i
[
0
],
0.0
,
0.0
],
[
bmidpoint
[
0
],
bmidpoint
[
1
],
0.0
]]]]
o
.
facets
+=
[[[
0
,
0
,
-
1
],
[[
pscale
*
i
[
0
],
2.0
*
bmidpoint
[
0
],
0.0
],
[
pscale
*
i
[
1
],
2.0
*
bmidpoint
[
0
],
0.0
],
[
bmidpoint
[
0
],
bmidpoint
[
1
],
0.0
]]]]
o
.
facets
+=
[[[
0
,
0
,
-
1
],
[[
pscale
*
i
[
0
],
2.0
*
bmidpoint
[
0
],
0.0
],
[
pscale
*
i
[
1
],
2.0
*
bmidpoint
[
0
],
0.0
],
[
bmidpoint
[
0
],
bmidpoint
[
1
],
0.0
]]]]
o
.
facets
+=
[
genfacet
([[
pscale
*
i
[
1
],
0.0
,
data
[
0
][
i
[
1
]]
*
zscale
+
bheight
],
[
pscale
*
i
[
0
],
0.0
,
data
[
0
][
i
[
0
]]
*
zscale
+
bheight
],
[
pscale
*
i
[
1
],
0.0
,
0.0
]])]
o
.
facets
+=
[
genfacet
([[
pscale
*
i
[
1
],
0.0
,
data
[
0
][
i
[
1
]]
*
zscale
+
bheight
],
[
pscale
*
i
[
0
],
0.0
,
data
[
0
][
i
[
0
]]
*
zscale
+
bheight
],
[
pscale
*
i
[
1
],
0.0
,
0.0
]])]
...
@@ -45,7 +45,7 @@ def genscape(data = [[0, 1, 0, 0], [1, 0, 2, 0], [1, 0, 0, 0], [0, 1, 0, 1]],
...
@@ -45,7 +45,7 @@ def genscape(data = [[0, 1, 0, 0], [1, 0, 2, 0], [1, 0, 0, 0], [0, 1, 0, 1]],
for
j
in
xrange
(
datal
-
1
):
for
j
in
xrange
(
datal
-
1
):
o
.
facets
+=
[
genfacet
([[
pscale
*
i
,
pscale
*
j
,
data
[
j
][
i
]
*
zscale
+
bheight
],
[
pscale
*
(
i
+
1
),
pscale
*
(
j
),
data
[
j
][
i
+
1
]
*
zscale
+
bheight
],
[
pscale
*
(
i
+
1
),
pscale
*
(
j
+
1
),
data
[
j
+
1
][
i
+
1
]
*
zscale
+
bheight
]])]
o
.
facets
+=
[
genfacet
([[
pscale
*
i
,
pscale
*
j
,
data
[
j
][
i
]
*
zscale
+
bheight
],
[
pscale
*
(
i
+
1
),
pscale
*
(
j
),
data
[
j
][
i
+
1
]
*
zscale
+
bheight
],
[
pscale
*
(
i
+
1
),
pscale
*
(
j
+
1
),
data
[
j
+
1
][
i
+
1
]
*
zscale
+
bheight
]])]
o
.
facets
+=
[
genfacet
([[
pscale
*
(
i
),
pscale
*
(
j
+
1
),
data
[
j
+
1
][
i
]
*
zscale
+
bheight
],
[
pscale
*
i
,
pscale
*
j
,
data
[
j
][
i
]
*
zscale
+
bheight
],
[
pscale
*
(
i
+
1
),
pscale
*
(
j
+
1
),
data
[
j
+
1
][
i
+
1
]
*
zscale
+
bheight
]])]
o
.
facets
+=
[
genfacet
([[
pscale
*
(
i
),
pscale
*
(
j
+
1
),
data
[
j
+
1
][
i
]
*
zscale
+
bheight
],
[
pscale
*
i
,
pscale
*
j
,
data
[
j
][
i
]
*
zscale
+
bheight
],
[
pscale
*
(
i
+
1
),
pscale
*
(
j
+
1
),
data
[
j
+
1
][
i
+
1
]
*
zscale
+
bheight
]])]
#print o.facets[-1]
#
print o.facets[-1]
return
o
return
o
def
zimage
(
name
,
out
):
def
zimage
(
name
,
out
):
i
=
wx
.
Image
(
name
)
i
=
wx
.
Image
(
name
)
...
@@ -55,7 +55,7 @@ def zimage(name, out):
...
@@ -55,7 +55,7 @@ def zimage(name, out):
data
=
[]
data
=
[]
for
i
in
xrange
(
s
[
0
]):
for
i
in
xrange
(
s
[
0
]):
data
+=
[
b
[
i
*
s
[
1
]:(
i
+
1
)
*
s
[
1
]]]
data
+=
[
b
[
i
*
s
[
1
]:(
i
+
1
)
*
s
[
1
]]]
#data = [i[::5] for i in data[::5]]
#
data = [i[::5] for i in data[::5]]
emitstl
(
out
,
genscape
(
data
,
zscale
=
0.1
)
.
facets
,
name
)
emitstl
(
out
,
genscape
(
data
,
zscale
=
0.1
)
.
facets
,
name
)
"""
"""
...
...
pronterface.py
View file @
d6bd9e75
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
import
sys
import
sys
try
:
try
:
import
wx
import
wx
# NOQA
except
:
except
:
print
(
"wxPython is not installed. This program requires wxPython to run."
)
print
(
"wxPython is not installed. This program requires wxPython to run."
)
if
sys
.
version_info
.
major
>=
3
:
if
sys
.
version_info
.
major
>=
3
:
...
...
setup.py
View file @
d6bd9e75
...
@@ -122,8 +122,8 @@ if sys.argv[1] in("install", "uninstall") and len(prefix):
...
@@ -122,8 +122,8 @@ if sys.argv[1] in("install", "uninstall") and len(prefix):
target_images_path
=
"share/pronterface/images/"
target_images_path
=
"share/pronterface/images/"
data_files
=
[(
'share/pixmaps/'
,
[
'pronterface.png'
,
'plater.png'
,
'pronsole.png'
]),
data_files
=
[(
'share/pixmaps/'
,
[
'pronterface.png'
,
'plater.png'
,
'pronsole.png'
]),
(
'share/applications'
,
[
'pronterface.desktop'
,
'pronsole.desktop'
,
'plater.desktop'
]),
(
'share/applications'
,
[
'pronterface.desktop'
,
'pronsole.desktop'
,
'plater.desktop'
]),
(
'share/appdata'
,
[
'pronterface.appdata.xml'
,
'pronsole.appdata.xml'
,
'plater.appdata.xml'
])]
(
'share/appdata'
,
[
'pronterface.appdata.xml'
,
'pronsole.appdata.xml'
,
'plater.appdata.xml'
])]
for
basedir
,
subdirs
,
files
in
os
.
walk
(
"images"
):
for
basedir
,
subdirs
,
files
in
os
.
walk
(
"images"
):
images
=
[]
images
=
[]
...
...
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