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
Show 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):
...
@@ -308,18 +308,25 @@ class StlPlater(Plater):
def
export_to
(
self
,
name
):
def
export_to
(
self
,
name
):
sf
=
open
(
name
.
replace
(
"."
,
"_"
)
+
".scad"
,
"w"
)
sf
=
open
(
name
.
replace
(
"."
,
"_"
)
+
".scad"
,
"w"
)
facets
=
[]
facets
=
[]
for
i
in
self
.
models
.
values
():
for
model
in
self
.
models
.
values
():
r
=
i
.
rot
r
=
model
.
rot
rot
=
[
0
,
0
,
r
]
if
r
else
None
rot
=
[
0
,
0
,
r
]
if
r
else
None
o
=
i
.
offsets
o
=
model
.
offsets
co
=
i
.
centeroffset
co
=
model
.
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])"
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
]))
"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
:
if
rot
:
i
=
i
.
rotate
(
rot
)
model
=
model
.
rotate
(
rot
)
if
trans
:
if
any
(
o
)
:
i
=
i
.
translate
(
trans
)
model
=
model
.
translate
(
o
)
facets
+=
i
.
facets
facets
+=
model
.
facets
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
...
...
printrun/stlview.py
View file @
d79c8ff2
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
import
wx
import
wx
import
time
import
time
import
threading
import
pyglet
import
pyglet
pyglet
.
options
[
'debug_gl'
]
=
True
pyglet
.
options
[
'debug_gl'
]
=
True
...
@@ -358,8 +357,8 @@ class StlViewPanel(wxGLPanel):
...
@@ -358,8 +357,8 @@ class StlViewPanel(wxGLPanel):
model
=
self
.
parent
.
models
[
i
]
model
=
self
.
parent
.
models
[
i
]
glPushMatrix
()
glPushMatrix
()
glTranslatef
(
*
(
model
.
offsets
))
glTranslatef
(
*
(
model
.
offsets
))
glTranslatef
(
*
(
model
.
centeroffset
))
glRotatef
(
model
.
rot
,
0.0
,
0.0
,
1.0
)
glRotatef
(
model
.
rot
,
0.0
,
0.0
,
1.0
)
glTranslatef
(
*
(
model
.
centeroffset
))
glScalef
(
*
model
.
scale
)
glScalef
(
*
model
.
scale
)
model
.
batch
.
draw
()
model
.
batch
.
draw
()
glPopMatrix
()
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