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
da9b819d
Commit
da9b819d
authored
Jul 25, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move move_shape to Plater
parent
87487632
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
49 deletions
+27
-49
objectplater.py
printrun/objectplater.py
+17
-0
stlview.py
printrun/stlview.py
+10
-49
No files found.
printrun/objectplater.py
View file @
da9b819d
...
...
@@ -81,6 +81,23 @@ class Plater(wx.Frame):
self
.
s
=
viewer
self
.
mainsizer
.
Add
(
self
.
s
,
1
,
wx
.
EXPAND
)
def
move_shape
(
self
,
delta
):
"""moves shape (selected in l, which is list ListBox of shapes)
by an offset specified in tuple delta.
Positive numbers move to (rigt, down)"""
name
=
self
.
l
.
GetSelection
()
if
name
==
wx
.
NOT_FOUND
:
return
False
name
=
self
.
l
.
GetString
(
name
)
model
=
self
.
models
[
name
]
model
.
offsets
=
[
model
.
offsets
[
0
]
+
delta
[
0
],
model
.
offsets
[
1
]
+
delta
[
1
],
model
.
offsets
[
2
]
]
return
True
def
autoplate
(
self
,
event
=
None
):
print
_
(
"Autoplating"
)
separation
=
2
...
...
printrun/stlview.py
View file @
da9b819d
...
...
@@ -145,24 +145,6 @@ class StlViewPanel(wxGLPanel):
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
-
1
))
self
.
initialized
=
0
def
move_shape
(
self
,
delta
):
"""moves shape (selected in l, which is list ListBox of shapes)
by an offset specified in tuple delta.
Positive numbers move to (rigt, down)"""
name
=
self
.
parent
.
l
.
GetSelection
()
if
name
==
wx
.
NOT_FOUND
:
return
False
name
=
self
.
parent
.
l
.
GetString
(
name
)
model
=
self
.
parent
.
models
[
name
]
model
.
offsets
=
[
model
.
offsets
[
0
]
+
delta
[
0
],
model
.
offsets
[
1
]
+
delta
[
1
],
model
.
offsets
[
2
]
]
self
.
Refresh
()
return
True
def
move
(
self
,
event
):
"""react to mouse actions:
no mouse: show red mousedrop
...
...
@@ -181,20 +163,13 @@ class StlViewPanel(wxGLPanel):
p2
=
event
.
GetPositionTuple
()
x1
,
y1
,
_
=
self
.
mouse_to_3d
(
p1
[
0
],
p1
[
1
])
x2
,
y2
,
_
=
self
.
mouse_to_3d
(
p2
[
0
],
p2
[
1
])
self
.
move_shape
((
x2
-
x1
,
y2
-
y1
))
self
.
parent
.
move_shape
((
x2
-
x1
,
y2
-
y1
))
self
.
initpos
=
p2
return
p1
=
self
.
initpos
p2
=
event
.
GetPositionTuple
()
sz
=
self
.
GetClientSize
()
p1x
=
(
float
(
p1
[
0
])
-
sz
[
0
]
/
2
)
/
(
sz
[
0
]
/
2
)
p1y
=
-
(
float
(
p1
[
1
])
-
sz
[
1
]
/
2
)
/
(
sz
[
1
]
/
2
)
p2x
=
(
float
(
p2
[
0
])
-
sz
[
0
]
/
2
)
/
(
sz
[
0
]
/
2
)
p2y
=
-
(
float
(
p2
[
1
])
-
sz
[
1
]
/
2
)
/
(
sz
[
1
]
/
2
)
quat
=
trackball
(
p1x
,
p1y
,
p2x
,
p2y
,
0.8
)
self
.
basequat
=
mulquat
(
self
.
basequat
,
quat
)
self
.
initpos
=
p2
self
.
Refresh
()
else
:
self
.
handle_rotation
(
event
)
elif
event
.
Dragging
()
and
event
.
RightIsDown
():
self
.
handle_translation
(
event
)
elif
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
self
.
initpos
is
not
None
:
self
.
initpos
=
None
...
...
@@ -202,20 +177,6 @@ class StlViewPanel(wxGLPanel):
if
self
.
initpos
is
not
None
:
self
.
initpos
=
None
elif
event
.
Dragging
()
and
event
.
RightIsDown
():
if
self
.
initpos
is
None
:
self
.
initpos
=
event
.
GetPositionTuple
()
else
:
p1
=
self
.
initpos
p2
=
event
.
GetPositionTuple
()
if
self
.
orthographic
:
x1
,
y1
,
_
=
self
.
mouse_to_3d
(
p1
[
0
],
p1
[
1
])
x2
,
y2
,
_
=
self
.
mouse_to_3d
(
p2
[
0
],
p2
[
1
])
glTranslatef
(
x2
-
x1
,
y2
-
y1
,
0
)
else
:
glTranslatef
(
p2
[
0
]
-
p1
[
0
],
-
(
p2
[
1
]
-
p1
[
1
]),
0
)
self
.
initpos
=
p2
def
rotate_shape
(
self
,
angle
):
"""rotates acive shape
positive angle is clockwise
...
...
@@ -260,16 +221,16 @@ class StlViewPanel(wxGLPanel):
angle
=
1
#h
if
keycode
==
72
:
self
.
move_shape
((
-
step
,
0
))
self
.
parent
.
move_shape
((
-
step
,
0
))
#l
if
keycode
==
76
:
self
.
move_shape
((
step
,
0
))
self
.
parent
.
move_shape
((
step
,
0
))
#j
if
keycode
==
75
:
self
.
move_shape
((
0
,
step
))
self
.
parent
.
move_shape
((
0
,
step
))
#k
if
keycode
==
74
:
self
.
move_shape
((
0
,
-
step
))
self
.
parent
.
move_shape
((
0
,
-
step
))
#[
if
keycode
==
91
:
self
.
rotate_shape
(
-
angle
)
...
...
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