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
21c0b9aa
Commit
21c0b9aa
authored
Sep 16, 2011
by
Travis Howse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only adds filename to list, not full path.
parent
50c2c434
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
plater.py
plater.py
+20
-19
No files found.
plater.py
View file @
21c0b9aa
#!/usr/bin/env python
import
wx
,
time
,
random
,
threading
,
os
,
math
import
stltool
import
re
class
stlwrap
:
def
__init__
(
self
,
obj
,
name
=
None
):
...
...
@@ -8,10 +9,10 @@ class stlwrap:
self
.
name
=
name
if
name
is
None
:
self
.
name
=
obj
.
name
def
__repr__
(
self
):
return
self
.
name
class
showstl
(
wx
.
Window
):
def
__init__
(
self
,
parent
,
size
,
pos
):
...
...
@@ -80,7 +81,7 @@ class showstl(wx.Window):
facets
+=
i
.
facets
stltool
.
emitstl
(
name
,
facets
,
"plater_export"
)
print
"wrote "
,
name
def
autoplate
(
self
,
event
):
print
"Autoplating"
separation
=
2
...
...
@@ -118,7 +119,7 @@ class showstl(wx.Window):
self
.
models
[
i
]
.
offsets
[
0
]
+=
centreoffset
[
0
]
self
.
models
[
i
]
.
offsets
[
1
]
+=
centreoffset
[
1
]
self
.
Refresh
()
def
right
(
self
,
event
):
dlg
=
wx
.
FileDialog
(
self
,
"Open file to print"
,
self
.
basedir
,
style
=
wx
.
FD_OPEN
|
wx
.
FD_FILE_MUST_EXIST
)
dlg
.
SetWildcard
(
"STL files (;*.stl;)"
)
...
...
@@ -131,10 +132,11 @@ class showstl(wx.Window):
t
=
time
.
time
()
#print name
if
name
.
lower
()
.
endswith
(
".stl"
):
newname
=
name
#Filter out the path, just show the STL filename.
newname
=
re
.
match
(
r".*[/\\](.*?\.stl)"
,
name
.
lower
())
.
group
(
1
)
c
=
1
while
newname
in
self
.
models
:
newname
=
name
+
"(
%
d)"
%
c
newname
=
n
ewn
ame
+
"(
%
d)"
%
c
c
+=
1
self
.
models
[
newname
]
=
stltool
.
stl
(
name
)
self
.
models
[
newname
]
.
offsets
=
[
0
,
0
,
0
]
...
...
@@ -177,17 +179,17 @@ class showstl(wx.Window):
# break
dc
.
SelectObject
(
wx
.
NullBitmap
)
m
.
bitmap
.
SetMask
(
wx
.
Mask
(
m
.
bitmap
,
wx
.
Colour
(
0
,
0
,
0
,
255
)))
#print time.time()-t
self
.
l
.
Append
(
newname
)
i
=
self
.
l
.
GetSelection
()
if
i
==
wx
.
NOT_FOUND
:
self
.
l
.
Select
(
0
)
self
.
l
.
Select
(
self
.
l
.
GetCount
()
-
1
)
self
.
Refresh
()
#print time.time()-t
def
move
(
self
,
event
):
if
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
(
self
.
initpos
is
not
None
):
...
...
@@ -212,12 +214,12 @@ class showstl(wx.Window):
p
=
event
.
GetPositionTuple
()
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)
del
dc
else
:
event
.
Skip
()
def
rotateafter
(
self
):
if
(
self
.
i
!=
self
.
previ
):
i
=
self
.
l
.
GetSelection
()
...
...
@@ -231,7 +233,7 @@ class showstl(wx.Window):
time
.
sleep
(
0.01
)
wx
.
CallAfter
(
self
.
rotateafter
)
self
.
triggered
=
0
def
rot
(
self
,
event
):
z
=
event
.
GetWheelRotation
()
s
=
self
.
l
.
GetSelection
()
...
...
@@ -245,11 +247,11 @@ class showstl(wx.Window):
if
not
self
.
triggered
:
self
.
triggered
=
1
threading
.
Thread
(
target
=
self
.
cr
)
.
start
()
def
repaint
(
self
,
event
):
dc
=
wx
.
PaintDC
(
self
)
self
.
paint
(
dc
=
dc
)
def
paint
(
self
,
coord1
=
"x"
,
coord2
=
"y"
,
dc
=
None
):
coords
=
{
"x"
:
0
,
"y"
:
1
,
"z"
:
2
}
if
dc
is
None
:
...
...
@@ -287,17 +289,16 @@ class showstl(wx.Window):
del
dc
#print time.time()-t
#s.export()
class
stlwin
(
wx
.
Frame
):
def
__init__
(
self
,
size
=
(
400
,
530
)):
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
.
SetClientSize
(
size
)
self
.
s
=
showstl
(
self
,(
400
,
530
),(
0
,
0
))
if
__name__
==
'__main__'
:
app
=
wx
.
App
(
False
)
main
=
stlwin
()
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