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
77ca068e
Commit
77ca068e
authored
Jul 25, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaner, more generic object move
parent
0a6e668b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
30 deletions
+22
-30
gcodeplater.py
gcodeplater.py
+1
-17
objectplater.py
printrun/objectplater.py
+20
-0
stlview.py
printrun/stlview.py
+1
-13
No files found.
gcodeplater.py
View file @
77ca068e
...
@@ -28,22 +28,6 @@ from printrun import gcoder
...
@@ -28,22 +28,6 @@ from printrun import gcoder
from
printrun.objectplater
import
Plater
from
printrun.objectplater
import
Plater
from
printrun.gl.libtatlin
import
actors
from
printrun.gl.libtatlin
import
actors
class
GcodeViewPanel
(
gcview
.
GcodeViewPanel
):
def
handle_rotation
(
self
,
event
):
if
self
.
initpos
is
None
:
self
.
initpos
=
event
.
GetPositionTuple
()
else
:
if
not
event
.
ShiftDown
():
p1
=
self
.
initpos
p2
=
event
.
GetPositionTuple
()
x1
,
y1
,
_
=
self
.
mouse_to_3d
(
p1
[
0
],
p1
[
1
])
x2
,
y2
,
_
=
self
.
mouse_to_3d
(
p2
[
0
],
p2
[
1
])
self
.
parent
.
move_shape
((
x2
-
x1
,
y2
-
y1
))
self
.
initpos
=
p2
else
:
super
(
GcodeViewPanel
,
self
)
.
handle_rotation
(
event
)
class
GcodePlater
(
Plater
):
class
GcodePlater
(
Plater
):
load_wildcard
=
_
(
"STL files (*.stl;*.STL)|*.stl;*.STL|OpenSCAD files (*.scad)|*.scad"
)
load_wildcard
=
_
(
"STL files (*.stl;*.STL)|*.stl;*.STL|OpenSCAD files (*.scad)|*.scad"
)
...
@@ -51,7 +35,7 @@ class GcodePlater(Plater):
...
@@ -51,7 +35,7 @@ class GcodePlater(Plater):
def
__init__
(
self
,
filenames
=
[],
size
=
(
800
,
580
),
callback
=
None
,
parent
=
None
,
build_dimensions
=
None
):
def
__init__
(
self
,
filenames
=
[],
size
=
(
800
,
580
),
callback
=
None
,
parent
=
None
,
build_dimensions
=
None
):
super
(
GcodePlater
,
self
)
.
__init__
(
filenames
,
size
,
callback
,
parent
,
build_dimensions
)
super
(
GcodePlater
,
self
)
.
__init__
(
filenames
,
size
,
callback
,
parent
,
build_dimensions
)
viewer
=
GcodeViewPanel
(
self
,
build_dimensions
=
self
.
build_dimensions
)
viewer
=
gcview
.
GcodeViewPanel
(
self
,
build_dimensions
=
self
.
build_dimensions
)
self
.
set_viewer
(
viewer
)
self
.
set_viewer
(
viewer
)
self
.
platform
=
actors
.
Platform
(
self
.
build_dimensions
)
self
.
platform
=
actors
.
Platform
(
self
.
build_dimensions
)
self
.
platform_object
=
gcview
.
GCObject
(
self
.
platform
)
self
.
platform_object
=
gcview
.
GCObject
(
self
.
platform
)
...
...
printrun/objectplater.py
View file @
77ca068e
...
@@ -19,6 +19,7 @@ from printrun.printrun_utils import install_locale, iconfile
...
@@ -19,6 +19,7 @@ from printrun.printrun_utils import install_locale, iconfile
install_locale
(
'plater'
)
install_locale
(
'plater'
)
import
os
import
os
import
types
import
wx
import
wx
class
Plater
(
wx
.
Frame
):
class
Plater
(
wx
.
Frame
):
...
@@ -78,6 +79,25 @@ class Plater(wx.Frame):
...
@@ -78,6 +79,25 @@ class Plater(wx.Frame):
self
.
build_dimensions
=
[
200
,
200
,
100
,
0
,
0
,
0
]
self
.
build_dimensions
=
[
200
,
200
,
100
,
0
,
0
,
0
]
def
set_viewer
(
self
,
viewer
):
def
set_viewer
(
self
,
viewer
):
# Patch handle_rotation on the fly
if
hasattr
(
viewer
,
"handle_rotation"
):
orig_handler
=
viewer
.
handle_rotation
def
handle_rotation
(
self
,
event
,
orig_handler
=
orig_handler
):
if
self
.
initpos
is
None
:
self
.
initpos
=
event
.
GetPositionTuple
()
else
:
if
not
event
.
ShiftDown
():
p1
=
self
.
initpos
p2
=
event
.
GetPositionTuple
()
x1
,
y1
,
_
=
self
.
mouse_to_3d
(
p1
[
0
],
p1
[
1
])
x2
,
y2
,
_
=
self
.
mouse_to_3d
(
p2
[
0
],
p2
[
1
])
self
.
parent
.
move_shape
((
x2
-
x1
,
y2
-
y1
))
self
.
initpos
=
p2
else
:
orig_handler
(
self
,
event
)
viewer
.
handle_rotation
=
types
.
MethodType
(
handle_rotation
,
viewer
)
self
.
s
=
viewer
self
.
s
=
viewer
self
.
mainsizer
.
Add
(
self
.
s
,
1
,
wx
.
EXPAND
)
self
.
mainsizer
.
Add
(
self
.
s
,
1
,
wx
.
EXPAND
)
...
...
printrun/stlview.py
View file @
77ca068e
...
@@ -155,19 +155,7 @@ class StlViewPanel(wxGLPanel):
...
@@ -155,19 +155,7 @@ class StlViewPanel(wxGLPanel):
"""
"""
self
.
mousepos
=
event
.
GetPositionTuple
()
self
.
mousepos
=
event
.
GetPositionTuple
()
if
event
.
Dragging
()
and
event
.
LeftIsDown
():
if
event
.
Dragging
()
and
event
.
LeftIsDown
():
if
self
.
initpos
is
None
:
self
.
handle_rotation
(
event
)
self
.
initpos
=
event
.
GetPositionTuple
()
else
:
if
not
event
.
ShiftDown
():
p1
=
self
.
initpos
p2
=
event
.
GetPositionTuple
()
x1
,
y1
,
_
=
self
.
mouse_to_3d
(
p1
[
0
],
p1
[
1
])
x2
,
y2
,
_
=
self
.
mouse_to_3d
(
p2
[
0
],
p2
[
1
])
self
.
parent
.
move_shape
((
x2
-
x1
,
y2
-
y1
))
self
.
initpos
=
p2
self
.
Refresh
()
else
:
self
.
handle_rotation
(
event
)
elif
event
.
Dragging
()
and
event
.
RightIsDown
():
elif
event
.
Dragging
()
and
event
.
RightIsDown
():
self
.
handle_translation
(
event
)
self
.
handle_translation
(
event
)
elif
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
elif
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
...
...
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