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
50a1719f
Commit
50a1719f
authored
Oct 22, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finally fix #561: get rid of most print calls in printrun
parent
1ae900f8
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
26 additions
and
23 deletions
+26
-23
gcodeplater.py
printrun/gcodeplater.py
+3
-2
gcview.py
printrun/gcview.py
+3
-2
__init__.py
printrun/gui/__init__.py
+3
-1
injectgcode.py
printrun/injectgcode.py
+4
-2
objectplater.py
printrun/objectplater.py
+3
-2
printcore.py
printrun/printcore.py
+1
-1
stlplater.py
printrun/stlplater.py
+7
-8
stltool.py
printrun/stltool.py
+2
-3
stlview.py
printrun/stlview.py
+0
-2
No files found.
printrun/gcodeplater.py
View file @
50a1719f
...
...
@@ -27,6 +27,7 @@ import time
import
types
import
re
import
math
import
logging
from
printrun
import
gcoder
from
printrun.objectplater
import
Plater
...
...
@@ -189,7 +190,7 @@ class GcodePlater(Plater):
laste
[
model_i
]
=
analyzer
.
current_e
lastrelative
[
model_i
]
=
analyzer
.
relative
lasttool
[
model_i
]
=
analyzer
.
current_tool
print
_
(
"Exported merged G-Codes to
%
s"
)
%
name
logging
.
info
(
_
(
"Exported merged G-Codes to
%
s"
)
%
name
)
def
export_sequential
(
self
,
name
):
models
=
self
.
models
.
values
()
...
...
@@ -226,7 +227,7 @@ class GcodePlater(Plater):
-
trans
[
1
]
+
gline
.
current_y
,
-
trans
[
2
]
+
gline
.
current_z
)
break
print
_
(
"Exported merged G-Codes to
%
s"
)
%
name
logging
.
info
(
_
(
"Exported merged G-Codes to
%
s"
)
%
name
)
if
__name__
==
'__main__'
:
app
=
wx
.
App
(
False
)
...
...
printrun/gcview.py
View file @
50a1719f
...
...
@@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
import
logging
import
wx
from
.
import
gcoder
...
...
@@ -94,7 +95,7 @@ class GcodeViewPanel(wxGLPanel):
if
filtered
:
injector
(
self
.
parent
.
model
.
gcode
,
l
,
filtered
[
0
])
else
:
print
_
(
"Invalid layer for injection"
)
logging
.
error
(
_
(
"Invalid layer for injection"
)
)
def
editlayer
(
self
):
l
=
self
.
parent
.
model
.
num_layers_to_draw
...
...
@@ -102,7 +103,7 @@ class GcodeViewPanel(wxGLPanel):
if
filtered
:
injector_edit
(
self
.
parent
.
model
.
gcode
,
l
,
filtered
[
0
])
else
:
print
_
(
"Invalid layer for edition"
)
logging
.
error
(
_
(
"Invalid layer for edition"
)
)
def
setlayercb
(
self
,
layer
):
pass
...
...
printrun/gui/__init__.py
View file @
50a1719f
...
...
@@ -13,10 +13,12 @@
# You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
import
logging
try
:
import
wx
except
:
print
_
(
"WX is not installed. This program requires WX to run."
)
logging
.
error
(
_
(
"WX is not installed. This program requires WX to run."
)
)
raise
from
printrun.utils
import
install_locale
...
...
printrun/injectgcode.py
View file @
50a1719f
...
...
@@ -13,6 +13,8 @@
# You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
import
logging
from
.gui.widgets
import
MacroEditor
from
.utils
import
install_locale
...
...
@@ -35,9 +37,9 @@ def injector_edit(gcode, viz_layer, layer_idx):
def
inject
(
gcode
,
viz_layer
,
layer_idx
,
toadd
):
# TODO: save modified gcode after injection ?
nlines
=
len
(
gcode
.
prepend_to_layer
(
toadd
,
layer_idx
))
print
_
(
"Successfully injected
%
d lines at beginning of layer
%
d"
)
%
(
nlines
,
viz_layer
)
logging
.
info
(
_
(
"Successfully injected
%
d lines at beginning of layer
%
d"
)
%
(
nlines
,
viz_layer
)
)
def
rewritelayer
(
gcode
,
viz_layer
,
layer_idx
,
toadd
):
# TODO: save modified gcode after edit ?
nlines
=
len
(
gcode
.
rewrite_layer
(
toadd
,
layer_idx
))
print
_
(
"Successfully edited layer
%
d (which now contains
%
d lines)"
)
%
(
viz_layer
,
nlines
)
logging
.
info
(
_
(
"Successfully edited layer
%
d (which now contains
%
d lines)"
)
%
(
viz_layer
,
nlines
)
)
printrun/objectplater.py
View file @
50a1719f
...
...
@@ -18,6 +18,7 @@
from
.utils
import
install_locale
,
iconfile
install_locale
(
'plater'
)
import
logging
import
os
import
types
import
wx
...
...
@@ -148,7 +149,7 @@ class Plater(wx.Frame):
model
.
rot
+=
angle
def
autoplate
(
self
,
event
=
None
):
print
_
(
"Autoplating"
)
logging
.
info
(
_
(
"Autoplating"
)
)
separation
=
2
try
:
from
printrun
import
packer
...
...
@@ -195,7 +196,7 @@ class Plater(wx.Frame):
max
[
1
]
=
cursor
[
1
]
+
x
cursor
[
0
]
+=
x
+
separation
if
(
cursor
[
1
]
+
y
)
>=
bedsize
[
1
]:
print
_
(
"Bed full, sorry sir :("
)
logging
.
info
(
_
(
"Bed full, sorry sir :("
)
)
self
.
Refresh
()
return
centerx
=
self
.
build_dimensions
[
0
]
/
2
+
self
.
build_dimensions
[
3
]
...
...
printrun/printcore.py
View file @
50a1719f
...
...
@@ -263,7 +263,7 @@ class printcore():
while
not
self
.
online
and
self
.
_listen_can_continue
():
self
.
_send
(
"M105"
)
if
self
.
writefailures
>=
4
:
print
_
(
"Aborting connection attempt after 4 failed writes."
)
logging
.
error
(
_
(
"Aborting connection attempt after 4 failed writes."
)
)
return
empty_lines
=
0
while
self
.
_listen_can_continue
():
...
...
printrun/stlplater.py
View file @
50a1719f
...
...
@@ -137,7 +137,6 @@ class showstl(wx.Window):
def
keypress
(
self
,
event
):
"""gets keypress events and moves/rotates acive shape"""
keycode
=
event
.
GetKeyCode
()
# print keycode
step
=
5
angle
=
18
if
event
.
ControlDown
():
...
...
@@ -294,7 +293,7 @@ class StlPlater(Plater):
model
=
self
.
models
[
name
]
transformation
=
transformation_matrix
(
model
)
transformed
=
model
.
transform
(
transformation
)
print
_
(
"Cutting
%
s alongside
%
s axis"
)
%
(
name
,
self
.
cutting_axis
)
logging
.
info
(
_
(
"Cutting
%
s alongside
%
s axis"
)
%
(
name
,
self
.
cutting_axis
)
)
axes
=
[
"x"
,
"y"
,
"z"
]
cut
=
transformed
.
cut
(
axes
.
index
(
self
.
cutting_axis
),
self
.
cutting_direction
,
...
...
@@ -340,7 +339,7 @@ class StlPlater(Plater):
transformation
=
transformation_matrix
(
model
)
transformed
=
model
.
transform
(
transformation
)
if
not
transformed
.
intersect_box
(
ray_near
,
ray_far
):
print
"Skipping
%
s for rebase search"
%
key
logging
.
debug
(
"Skipping
%
s for rebase search"
%
key
)
continue
facet
,
facet_dist
=
transformed
.
intersect
(
ray_near
,
ray_far
)
if
facet
is
not
None
and
facet_dist
<
best_dist
:
...
...
@@ -348,7 +347,7 @@ class StlPlater(Plater):
best_facet
=
facet
best_dist
=
facet_dist
if
best_match
is
not
None
:
print
"Rebasing
%
s"
%
best_match
logging
.
info
(
"Rebasing
%
s"
%
best_match
)
model
=
self
.
models
[
best_match
]
newmodel
=
model
.
rebase
(
best_facet
)
newmodel
.
offsets
=
list
(
model
.
offsets
)
...
...
@@ -422,7 +421,7 @@ class StlPlater(Plater):
def
load_stl
(
self
,
name
):
if
not
os
.
path
.
exists
(
name
):
print
_
(
"Couldn't load non-existing file
%
s"
)
%
name
logging
.
error
(
_
(
"Couldn't load non-existing file
%
s"
)
%
name
)
return
path
=
os
.
path
.
split
(
name
)[
0
]
self
.
basedir
=
path
...
...
@@ -472,7 +471,7 @@ class StlPlater(Plater):
model
=
model
.
transform
(
transformation_matrix
(
model
))
facets
+=
model
.
facets
stltool
.
emitstl
(
name
,
facets
,
"plater_export"
)
print
_
(
"Wrote plate to
%
s"
)
%
name
logging
.
info
(
_
(
"Wrote plate to
%
s"
)
%
name
)
def
autoplate
(
self
,
event
=
None
):
try
:
...
...
@@ -484,7 +483,7 @@ class StlPlater(Plater):
super
(
StlPlater
,
self
)
.
autoplate
()
def
autoplate_simarrange
(
self
):
print
_
(
"Autoplating using simarrange"
)
logging
.
info
(
_
(
"Autoplating using simarrange"
)
)
models
=
dict
(
self
.
models
)
files
=
[
model
.
filename
for
model
in
models
.
values
()]
command
=
[
self
.
simarrange_path
,
"--dryrun"
,
...
...
@@ -499,7 +498,7 @@ class StlPlater(Plater):
if
"Generating plate"
in
line
:
plateid
=
int
(
line
.
split
()[
-
1
])
if
plateid
>
0
:
print
_
(
"Plate full, please remove some objects"
)
logging
.
error
(
_
(
"Plate full, please remove some objects"
)
)
break
if
"File:"
in
line
:
bits
=
pos_regexp
.
match
(
line
)
.
groups
()
...
...
printrun/stltool.py
View file @
50a1719f
...
...
@@ -18,6 +18,7 @@
import
sys
import
struct
import
math
import
logging
import
numpy
import
numpy.linalg
...
...
@@ -170,7 +171,7 @@ class stl(object):
if
not
self
.
parseline
(
line
):
return
else
:
print
"Not an ascii stl solid - attempting to parse as binary"
logging
.
warning
(
"Not an ascii stl solid - attempting to parse as binary"
)
f
=
open
(
filename
,
"rb"
)
buf
=
f
.
read
(
84
)
while
len
(
buf
)
<
84
:
...
...
@@ -348,8 +349,6 @@ class stl(object):
if
l
.
startswith
(
"solid"
):
self
.
insolid
=
1
self
.
name
=
l
[
6
:]
# print self.name
elif
l
.
startswith
(
"endsolid"
):
self
.
insolid
=
0
return
0
...
...
printrun/stlview.py
View file @
50a1719f
...
...
@@ -55,7 +55,6 @@ class stlview(object):
# 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))]
# print indices[:10]
self
.
vertex_list
=
batch
.
add_indexed
(
len
(
vertices
)
//
3
,
GL_TRIANGLES
,
None
,
# group,
...
...
@@ -206,7 +205,6 @@ class StlViewPanel(wxGLPanel):
def
keypress
(
self
,
event
):
"""gets keypress events and moves/rotates acive shape"""
keycode
=
event
.
GetKeyCode
()
print
keycode
step
=
5
angle
=
18
if
event
.
ControlDown
():
...
...
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