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
d79c8ff2
Commit
d79c8ff2
authored
Jul 25, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rotate objects around their center in plater
parent
65fc1711
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
plater.py
plater.py
+17
-10
stlview.py
printrun/stlview.py
+1
-2
No files found.
plater.py
View file @
d79c8ff2
...
...
@@ -308,18 +308,25 @@ class StlPlater(Plater):
def
export_to
(
self
,
name
):
sf
=
open
(
name
.
replace
(
"."
,
"_"
)
+
".scad"
,
"w"
)
facets
=
[]
for
i
in
self
.
models
.
values
():
r
=
i
.
rot
for
model
in
self
.
models
.
values
():
r
=
model
.
rot
rot
=
[
0
,
0
,
r
]
if
r
else
None
o
=
i
.
offsets
co
=
i
.
centeroffset
trans
=
[
o
[
0
]
+
co
[
0
],
o
[
1
]
+
co
[
1
],
o
[
2
]
+
co
[
2
]]
if
any
(
o
)
or
any
(
co
)
else
[
0
,
0
,
0
]
sf
.
write
(
'translate([
%
s,
%
s,
%
s]) rotate([0, 0,
%
s]) import_stl("
%
s");
\n
'
%
(
trans
[
0
],
trans
[
1
],
trans
[
2
],
r
,
os
.
path
.
split
(
i
.
filename
)[
1
]))
o
=
model
.
offsets
co
=
model
.
centeroffset
sf
.
write
(
"translate([
%
s,
%
s,
%
s])"
"rotate([0, 0,
%
s])"
"translate([
%
s,
%
s,
%
s])"
"import(
\"
%
s
\"
);
\n
"
%
(
co
[
0
],
co
[
1
],
co
[
2
],
r
,
o
[
0
],
o
[
1
],
o
[
2
],
model
.
filename
))
if
any
(
co
):
model
=
model
.
translate
(
co
)
if
rot
:
i
=
i
.
rotate
(
rot
)
if
trans
:
i
=
i
.
translate
(
trans
)
facets
+=
i
.
facets
model
=
model
.
rotate
(
rot
)
if
any
(
o
)
:
model
=
model
.
translate
(
o
)
facets
+=
model
.
facets
sf
.
close
()
stltool
.
emitstl
(
name
,
facets
,
"plater_export"
)
print
_
(
"Wrote plate to
%
s"
)
%
name
...
...
printrun/stlview.py
View file @
d79c8ff2
...
...
@@ -17,7 +17,6 @@
import
wx
import
time
import
threading
import
pyglet
pyglet
.
options
[
'debug_gl'
]
=
True
...
...
@@ -358,8 +357,8 @@ class StlViewPanel(wxGLPanel):
model
=
self
.
parent
.
models
[
i
]
glPushMatrix
()
glTranslatef
(
*
(
model
.
offsets
))
glTranslatef
(
*
(
model
.
centeroffset
))
glRotatef
(
model
.
rot
,
0.0
,
0.0
,
1.0
)
glTranslatef
(
*
(
model
.
centeroffset
))
glScalef
(
*
model
.
scale
)
model
.
batch
.
draw
()
glPopMatrix
()
...
...
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