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
944af2ce
Commit
944af2ce
authored
Aug 12, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add initial simarrange-based autoplating
parent
5567e2bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
plater.py
printrun/plater.py
+42
-0
No files found.
printrun/plater.py
View file @
944af2ce
...
@@ -27,7 +27,9 @@ import time
...
@@ -27,7 +27,9 @@ import time
import
threading
import
threading
import
math
import
math
import
sys
import
sys
import
re
import
traceback
import
traceback
import
subprocess
from
printrun
import
stltool
from
printrun
import
stltool
from
printrun.objectplater
import
Plater
from
printrun.objectplater
import
Plater
...
@@ -330,3 +332,43 @@ class StlPlater(Plater):
...
@@ -330,3 +332,43 @@ class StlPlater(Plater):
sf
.
close
()
sf
.
close
()
stltool
.
emitstl
(
name
,
facets
,
"plater_export"
)
stltool
.
emitstl
(
name
,
facets
,
"plater_export"
)
print
_
(
"Wrote plate to
%
s"
)
%
name
print
_
(
"Wrote plate to
%
s"
)
%
name
def
autoplate
(
self
,
event
=
None
):
try
:
self
.
autoplate_simarrange
()
except
:
traceback
.
print_exc
(
file
=
sys
.
stdout
)
print
_
(
"Failed to use simarrange for plating, "
"falling back to the standard method"
)
super
(
StlPlater
,
self
)
.
autoplate
()
def
autoplate_simarrange
(
self
):
raise
ValueError
print
_
(
"Autoplating using simarrange"
)
models
=
dict
(
self
.
models
)
files
=
[
model
.
filename
for
model
in
models
.
values
()]
p
=
subprocess
.
Popen
([
"./simarrange/sa"
,
"--dryrun"
]
+
files
,
stdout
=
subprocess
.
PIPE
)
pos_regexp
=
re
.
compile
(
"File: (.*) minx: ([0-9]+), miny: ([0-9]+), minrot: ([0-9]+)"
)
for
line
in
p
.
stdout
:
line
=
line
.
rstrip
()
if
"Generating plate"
in
line
:
plateid
=
int
(
line
.
split
()[
-
1
])
if
plateid
>
0
:
print
_
(
"Plate full, please remove some objects"
)
break
if
"File:"
in
line
:
bits
=
pos_regexp
.
match
(
line
)
.
groups
()
filename
=
bits
[
0
]
x
=
float
(
bits
[
1
])
y
=
float
(
bits
[
2
])
rot
=
float
(
bits
[
3
])
for
name
,
model
in
models
.
items
():
# FIXME: not sure this is going to work superwell with utf8
if
model
.
filename
==
filename
:
model
.
offsets
[
0
]
=
x
model
.
offsets
[
1
]
=
y
model
.
rot
=
rot
del
models
[
name
]
break
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