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
1289d3c2
Commit
1289d3c2
authored
Apr 05, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pythonic file handling in stlplater.export_to
parent
c3799528
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
24 deletions
+23
-24
stlplater.py
printrun/stlplater.py
+23
-24
No files found.
printrun/stlplater.py
View file @
1289d3c2
...
@@ -314,30 +314,29 @@ class StlPlater(Plater):
...
@@ -314,30 +314,29 @@ class StlPlater(Plater):
self
.
s
.
drawmodel
(
model
,
2
)
self
.
s
.
drawmodel
(
model
,
2
)
def
export_to
(
self
,
name
):
def
export_to
(
self
,
name
):
sf
=
open
(
name
.
replace
(
"."
,
"_"
)
+
".scad"
,
"w"
)
with
open
(
name
.
replace
(
"."
,
"_"
)
+
".scad"
,
"w"
)
as
sf
:
facets
=
[]
facets
=
[]
for
model
in
self
.
models
.
values
():
for
model
in
self
.
models
.
values
():
r
=
model
.
rot
r
=
model
.
rot
rot
=
[
0
,
0
,
r
]
if
r
else
None
rot
=
[
0
,
0
,
r
]
if
r
else
None
o
=
model
.
offsets
o
=
model
.
offsets
co
=
model
.
centeroffset
co
=
model
.
centeroffset
sf
.
write
(
"translate([
%
s,
%
s,
%
s])"
sf
.
write
(
"translate([
%
s,
%
s,
%
s])"
"rotate([0, 0,
%
s])"
"rotate([0, 0,
%
s])"
"translate([
%
s,
%
s,
%
s])"
"translate([
%
s,
%
s,
%
s])"
"import(
\"
%
s
\"
);
\n
"
%
(
o
[
0
],
o
[
1
],
o
[
2
],
"import(
\"
%
s
\"
);
\n
"
%
(
o
[
0
],
o
[
1
],
o
[
2
],
r
,
r
,
co
[
0
],
co
[
1
],
co
[
2
],
co
[
0
],
co
[
1
],
co
[
2
],
model
.
filename
))
model
.
filename
))
if
any
(
co
):
if
any
(
co
):
model
=
model
.
translate
(
co
)
model
=
model
.
translate
(
co
)
if
rot
:
if
rot
:
model
=
model
.
rotate
(
rot
)
model
=
model
.
rotate
(
rot
)
if
any
(
o
):
if
any
(
o
):
model
=
model
.
translate
(
o
)
model
=
model
.
translate
(
o
)
facets
+=
model
.
facets
facets
+=
model
.
facets
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
):
def
autoplate
(
self
,
event
=
None
):
try
:
try
:
...
...
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