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):
...
@@ -81,6 +81,23 @@ class Plater(wx.Frame):
self
.
s
=
viewer
self
.
s
=
viewer
self
.
mainsizer
.
Add
(
self
.
s
,
1
,
wx
.
EXPAND
)
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
):
def
autoplate
(
self
,
event
=
None
):
print
_
(
"Autoplating"
)
print
_
(
"Autoplating"
)
separation
=
2
separation
=
2
...
...
printrun/stlview.py
View file @
da9b819d
...
@@ -145,24 +145,6 @@ class StlViewPanel(wxGLPanel):
...
@@ -145,24 +145,6 @@ class StlViewPanel(wxGLPanel):
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
-
1
))
self
.
SetClientSize
((
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
]
-
1
))
self
.
initialized
=
0
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
):
def
move
(
self
,
event
):
"""react to mouse actions:
"""react to mouse actions:
no mouse: show red mousedrop
no mouse: show red mousedrop
...
@@ -181,20 +163,13 @@ class StlViewPanel(wxGLPanel):
...
@@ -181,20 +163,13 @@ class StlViewPanel(wxGLPanel):
p2
=
event
.
GetPositionTuple
()
p2
=
event
.
GetPositionTuple
()
x1
,
y1
,
_
=
self
.
mouse_to_3d
(
p1
[
0
],
p1
[
1
])
x1
,
y1
,
_
=
self
.
mouse_to_3d
(
p1
[
0
],
p1
[
1
])
x2
,
y2
,
_
=
self
.
mouse_to_3d
(
p2
[
0
],
p2
[
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
self
.
initpos
=
p2
return
self
.
Refresh
()
p1
=
self
.
initpos
else
:
p2
=
event
.
GetPositionTuple
()
self
.
handle_rotation
(
event
)
sz
=
self
.
GetClientSize
()
elif
event
.
Dragging
()
and
event
.
RightIsDown
():
p1x
=
(
float
(
p1
[
0
])
-
sz
[
0
]
/
2
)
/
(
sz
[
0
]
/
2
)
self
.
handle_translation
(
event
)
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
elif
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
elif
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
self
.
initpos
is
not
None
:
if
self
.
initpos
is
not
None
:
self
.
initpos
=
None
self
.
initpos
=
None
...
@@ -202,20 +177,6 @@ class StlViewPanel(wxGLPanel):
...
@@ -202,20 +177,6 @@ class StlViewPanel(wxGLPanel):
if
self
.
initpos
is
not
None
:
if
self
.
initpos
is
not
None
:
self
.
initpos
=
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
):
def
rotate_shape
(
self
,
angle
):
"""rotates acive shape
"""rotates acive shape
positive angle is clockwise
positive angle is clockwise
...
@@ -260,16 +221,16 @@ class StlViewPanel(wxGLPanel):
...
@@ -260,16 +221,16 @@ class StlViewPanel(wxGLPanel):
angle
=
1
angle
=
1
#h
#h
if
keycode
==
72
:
if
keycode
==
72
:
self
.
move_shape
((
-
step
,
0
))
self
.
parent
.
move_shape
((
-
step
,
0
))
#l
#l
if
keycode
==
76
:
if
keycode
==
76
:
self
.
move_shape
((
step
,
0
))
self
.
parent
.
move_shape
((
step
,
0
))
#j
#j
if
keycode
==
75
:
if
keycode
==
75
:
self
.
move_shape
((
0
,
step
))
self
.
parent
.
move_shape
((
0
,
step
))
#k
#k
if
keycode
==
74
:
if
keycode
==
74
:
self
.
move_shape
((
0
,
-
step
))
self
.
parent
.
move_shape
((
0
,
-
step
))
#[
#[
if
keycode
==
91
:
if
keycode
==
91
:
self
.
rotate_shape
(
-
angle
)
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