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
ad81fb62
Commit
ad81fb62
authored
Sep 16, 2011
by
Travis Howse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed formatting for pull request
parent
21c0b9aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
plater.py
plater.py
+18
-17
No files found.
plater.py
View file @
ad81fb62
...
@@ -9,10 +9,10 @@ class stlwrap:
...
@@ -9,10 +9,10 @@ class stlwrap:
self
.
name
=
name
self
.
name
=
name
if
name
is
None
:
if
name
is
None
:
self
.
name
=
obj
.
name
self
.
name
=
obj
.
name
def
__repr__
(
self
):
def
__repr__
(
self
):
return
self
.
name
return
self
.
name
class
showstl
(
wx
.
Window
):
class
showstl
(
wx
.
Window
):
def
__init__
(
self
,
parent
,
size
,
pos
):
def
__init__
(
self
,
parent
,
size
,
pos
):
...
@@ -81,7 +81,7 @@ class showstl(wx.Window):
...
@@ -81,7 +81,7 @@ class showstl(wx.Window):
facets
+=
i
.
facets
facets
+=
i
.
facets
stltool
.
emitstl
(
name
,
facets
,
"plater_export"
)
stltool
.
emitstl
(
name
,
facets
,
"plater_export"
)
print
"wrote "
,
name
print
"wrote "
,
name
def
autoplate
(
self
,
event
):
def
autoplate
(
self
,
event
):
print
"Autoplating"
print
"Autoplating"
separation
=
2
separation
=
2
...
@@ -119,7 +119,7 @@ class showstl(wx.Window):
...
@@ -119,7 +119,7 @@ class showstl(wx.Window):
self
.
models
[
i
]
.
offsets
[
0
]
+=
centreoffset
[
0
]
self
.
models
[
i
]
.
offsets
[
0
]
+=
centreoffset
[
0
]
self
.
models
[
i
]
.
offsets
[
1
]
+=
centreoffset
[
1
]
self
.
models
[
i
]
.
offsets
[
1
]
+=
centreoffset
[
1
]
self
.
Refresh
()
self
.
Refresh
()
def
right
(
self
,
event
):
def
right
(
self
,
event
):
dlg
=
wx
.
FileDialog
(
self
,
"Open file to print"
,
self
.
basedir
,
style
=
wx
.
FD_OPEN
|
wx
.
FD_FILE_MUST_EXIST
)
dlg
=
wx
.
FileDialog
(
self
,
"Open file to print"
,
self
.
basedir
,
style
=
wx
.
FD_OPEN
|
wx
.
FD_FILE_MUST_EXIST
)
dlg
.
SetWildcard
(
"STL files (;*.stl;)"
)
dlg
.
SetWildcard
(
"STL files (;*.stl;)"
)
...
@@ -132,7 +132,7 @@ class showstl(wx.Window):
...
@@ -132,7 +132,7 @@ class showstl(wx.Window):
t
=
time
.
time
()
t
=
time
.
time
()
#print name
#print name
if
name
.
lower
()
.
endswith
(
".stl"
):
if
name
.
lower
()
.
endswith
(
".stl"
):
#Filter out the path, just show the STL filename.
#Filter out the path, just show the STL filename.
newname
=
re
.
match
(
r".*[/\\](.*?\.stl)"
,
name
.
lower
())
.
group
(
1
)
newname
=
re
.
match
(
r".*[/\\](.*?\.stl)"
,
name
.
lower
())
.
group
(
1
)
c
=
1
c
=
1
while
newname
in
self
.
models
:
while
newname
in
self
.
models
:
...
@@ -179,17 +179,17 @@ class showstl(wx.Window):
...
@@ -179,17 +179,17 @@ class showstl(wx.Window):
# break
# break
dc
.
SelectObject
(
wx
.
NullBitmap
)
dc
.
SelectObject
(
wx
.
NullBitmap
)
m
.
bitmap
.
SetMask
(
wx
.
Mask
(
m
.
bitmap
,
wx
.
Colour
(
0
,
0
,
0
,
255
)))
m
.
bitmap
.
SetMask
(
wx
.
Mask
(
m
.
bitmap
,
wx
.
Colour
(
0
,
0
,
0
,
255
)))
#print time.time()-t
#print time.time()-t
self
.
l
.
Append
(
newname
)
self
.
l
.
Append
(
newname
)
i
=
self
.
l
.
GetSelection
()
i
=
self
.
l
.
GetSelection
()
if
i
==
wx
.
NOT_FOUND
:
if
i
==
wx
.
NOT_FOUND
:
self
.
l
.
Select
(
0
)
self
.
l
.
Select
(
0
)
self
.
l
.
Select
(
self
.
l
.
GetCount
()
-
1
)
self
.
l
.
Select
(
self
.
l
.
GetCount
()
-
1
)
self
.
Refresh
()
self
.
Refresh
()
#print time.time()-t
#print time.time()-t
def
move
(
self
,
event
):
def
move
(
self
,
event
):
if
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
(
self
.
initpos
is
not
None
):
if
(
self
.
initpos
is
not
None
):
...
@@ -214,12 +214,12 @@ class showstl(wx.Window):
...
@@ -214,12 +214,12 @@ class showstl(wx.Window):
p
=
event
.
GetPositionTuple
()
p
=
event
.
GetPositionTuple
()
dc
.
DrawLine
(
self
.
initpos
[
0
],
self
.
initpos
[
1
],
p
[
0
],
p
[
1
])
dc
.
DrawLine
(
self
.
initpos
[
0
],
self
.
initpos
[
1
],
p
[
0
],
p
[
1
])
#print math.sqrt((p[0]-self.initpos[0])**2+(p[1]-self.initpos[1])**2)
#print math.sqrt((p[0]-self.initpos[0])**2+(p[1]-self.initpos[1])**2)
del
dc
del
dc
else
:
else
:
event
.
Skip
()
event
.
Skip
()
def
rotateafter
(
self
):
def
rotateafter
(
self
):
if
(
self
.
i
!=
self
.
previ
):
if
(
self
.
i
!=
self
.
previ
):
i
=
self
.
l
.
GetSelection
()
i
=
self
.
l
.
GetSelection
()
...
@@ -233,7 +233,7 @@ class showstl(wx.Window):
...
@@ -233,7 +233,7 @@ class showstl(wx.Window):
time
.
sleep
(
0.01
)
time
.
sleep
(
0.01
)
wx
.
CallAfter
(
self
.
rotateafter
)
wx
.
CallAfter
(
self
.
rotateafter
)
self
.
triggered
=
0
self
.
triggered
=
0
def
rot
(
self
,
event
):
def
rot
(
self
,
event
):
z
=
event
.
GetWheelRotation
()
z
=
event
.
GetWheelRotation
()
s
=
self
.
l
.
GetSelection
()
s
=
self
.
l
.
GetSelection
()
...
@@ -247,11 +247,11 @@ class showstl(wx.Window):
...
@@ -247,11 +247,11 @@ class showstl(wx.Window):
if
not
self
.
triggered
:
if
not
self
.
triggered
:
self
.
triggered
=
1
self
.
triggered
=
1
threading
.
Thread
(
target
=
self
.
cr
)
.
start
()
threading
.
Thread
(
target
=
self
.
cr
)
.
start
()
def
repaint
(
self
,
event
):
def
repaint
(
self
,
event
):
dc
=
wx
.
PaintDC
(
self
)
dc
=
wx
.
PaintDC
(
self
)
self
.
paint
(
dc
=
dc
)
self
.
paint
(
dc
=
dc
)
def
paint
(
self
,
coord1
=
"x"
,
coord2
=
"y"
,
dc
=
None
):
def
paint
(
self
,
coord1
=
"x"
,
coord2
=
"y"
,
dc
=
None
):
coords
=
{
"x"
:
0
,
"y"
:
1
,
"z"
:
2
}
coords
=
{
"x"
:
0
,
"y"
:
1
,
"z"
:
2
}
if
dc
is
None
:
if
dc
is
None
:
...
@@ -289,16 +289,17 @@ class showstl(wx.Window):
...
@@ -289,16 +289,17 @@ class showstl(wx.Window):
del
dc
del
dc
#print time.time()-t
#print time.time()-t
#s.export()
#s.export()
class
stlwin
(
wx
.
Frame
):
class
stlwin
(
wx
.
Frame
):
def
__init__
(
self
,
size
=
(
400
,
530
)):
def
__init__
(
self
,
size
=
(
400
,
530
)):
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
"Right-click to add a file"
,
size
=
size
)
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
"Right-click to add a file"
,
size
=
size
)
self
.
SetIcon
(
wx
.
Icon
(
"plater.ico"
,
wx
.
BITMAP_TYPE_ICO
))
self
.
SetIcon
(
wx
.
Icon
(
"plater.ico"
,
wx
.
BITMAP_TYPE_ICO
))
self
.
SetClientSize
(
size
)
self
.
SetClientSize
(
size
)
self
.
s
=
showstl
(
self
,(
400
,
530
),(
0
,
0
))
self
.
s
=
showstl
(
self
,(
400
,
530
),(
0
,
0
))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
app
=
wx
.
App
(
False
)
app
=
wx
.
App
(
False
)
main
=
stlwin
()
main
=
stlwin
()
main
.
Show
()
main
.
Show
()
app
.
MainLoop
()
app
.
MainLoop
()
\ No newline at end of file
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