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
8610d61a
Commit
8610d61a
authored
Jun 08, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor out model to gcode rename and fix #394
This probably requires using an Unicode-based wx.
parent
559cf767
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
pronsole.py
pronsole.py
+4
-2
pronterface.py
pronterface.py
+11
-4
No files found.
pronsole.py
View file @
8610d61a
...
@@ -22,6 +22,7 @@ import math, codecs
...
@@ -22,6 +22,7 @@ import math, codecs
import
shlex
import
shlex
from
math
import
sqrt
from
math
import
sqrt
import
argparse
import
argparse
import
locale
import
printcore
import
printcore
from
printrun.printrun_utils
import
install_locale
from
printrun.printrun_utils
import
install_locale
...
@@ -795,7 +796,7 @@ class pronsole(cmd.Cmd):
...
@@ -795,7 +796,7 @@ class pronsole(cmd.Cmd):
if
not
filename
:
if
not
filename
:
self
.
log
(
"No file name given."
)
self
.
log
(
"No file name given."
)
return
return
self
.
log
(
"Loading file:"
+
filename
)
self
.
log
(
"Loading file:
"
+
filename
)
if
not
os
.
path
.
exists
(
filename
):
if
not
os
.
path
.
exists
(
filename
):
self
.
log
(
"File not found!"
)
self
.
log
(
"File not found!"
)
return
return
...
@@ -1418,7 +1419,8 @@ class pronsole(cmd.Cmd):
...
@@ -1418,7 +1419,8 @@ class pronsole(cmd.Cmd):
self
.
onecmd
(
command
)
self
.
onecmd
(
command
)
self
.
processing_args
=
False
self
.
processing_args
=
False
if
args
.
filename
:
if
args
.
filename
:
self
.
do_load
(
args
.
filename
)
filename
=
args
.
filename
.
decode
(
locale
.
getpreferredencoding
())
self
.
do_load
(
filename
)
def
parse_cmdline
(
self
,
args
):
def
parse_cmdline
(
self
,
args
):
parser
=
argparse
.
ArgumentParser
(
description
=
'Printrun 3D printer interface'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Printrun 3D printer interface'
)
...
...
pronterface.py
View file @
8610d61a
...
@@ -1356,12 +1356,19 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -1356,12 +1356,19 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
p
.
send_now
(
"M21"
)
self
.
p
.
send_now
(
"M21"
)
self
.
p
.
send_now
(
"M20"
)
self
.
p
.
send_now
(
"M20"
)
def
model_to_gcode_filename
(
self
,
filename
):
suffix
=
"_export.gcode"
for
ext
in
[
".stl"
,
".obj"
]:
filename
=
filename
.
replace
(
ext
,
suffix
)
filename
=
filename
.
replace
(
ext
.
upper
(),
suffix
)
return
filename
def
skein_func
(
self
):
def
skein_func
(
self
):
try
:
try
:
param
=
self
.
expandcommand
(
self
.
settings
.
slicecommand
)
.
encode
()
param
=
self
.
expandcommand
(
self
.
settings
.
slicecommand
)
print
"Slicing: "
,
param
print
"Slicing: "
,
param
pararray
=
[
i
.
replace
(
"$s"
,
self
.
filename
)
.
replace
(
"$o"
,
self
.
filename
.
replace
(
".stl"
,
"_export.gcode"
)
.
replace
(
".STL"
,
"_export.gcode"
))
.
encode
()
for
i
in
shlex
.
split
(
param
.
replace
(
"
\\
"
,
"
\\\\
"
)
.
encode
())]
output_filename
=
self
.
model_to_gcode_filename
(
self
.
filename
)
#print pararray
pararray
=
[
i
.
replace
(
"$s"
,
self
.
filename
)
.
replace
(
"$o"
,
output_filename
)
for
i
in
shlex
.
split
(
param
.
replace
(
"
\\
"
,
"
\\\\
"
))]
self
.
skeinp
=
subprocess
.
Popen
(
pararray
,
stderr
=
subprocess
.
STDOUT
,
stdout
=
subprocess
.
PIPE
)
self
.
skeinp
=
subprocess
.
Popen
(
pararray
,
stderr
=
subprocess
.
STDOUT
,
stdout
=
subprocess
.
PIPE
)
while
True
:
while
True
:
o
=
self
.
skeinp
.
stdout
.
read
(
1
)
o
=
self
.
skeinp
.
stdout
.
read
(
1
)
...
@@ -1383,7 +1390,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -1383,7 +1390,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
time
.
sleep
(
0.1
)
time
.
sleep
(
0.1
)
fn
=
self
.
filename
fn
=
self
.
filename
try
:
try
:
self
.
filename
=
self
.
filename
.
replace
(
".stl"
,
"_export.gcode"
)
.
replace
(
".STL"
,
"_export.gcode"
)
.
replace
(
".obj"
,
"_export.gcode"
)
.
replace
(
".OBJ"
,
"_export.gcode"
)
self
.
filename
=
self
.
model_to_gcode_filename
(
self
.
filename
)
self
.
fgcode
=
gcoder
.
GCode
(
open
(
self
.
filename
))
self
.
fgcode
=
gcoder
.
GCode
(
open
(
self
.
filename
))
if
self
.
p
.
online
:
if
self
.
p
.
online
:
wx
.
CallAfter
(
self
.
printbtn
.
Enable
)
wx
.
CallAfter
(
self
.
printbtn
.
Enable
)
...
...
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