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
6785eb65
Commit
6785eb65
authored
Nov 08, 2011
by
Steven Devijver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run everything through right, distinguish on extension to delegate to load_stl & load_scad
parent
b644182a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
42 deletions
+44
-42
plater.py
plater.py
+44
-42
No files found.
plater.py
View file @
6785eb65
...
@@ -29,7 +29,7 @@ class showstl(wx.Window):
...
@@ -29,7 +29,7 @@ class showstl(wx.Window):
self
.
cb
=
wx
.
Button
(
self
,
label
=
"Put at 100,100"
,
pos
=
(
300
,
size
[
1
]
-
80
))
self
.
cb
=
wx
.
Button
(
self
,
label
=
"Put at 100,100"
,
pos
=
(
300
,
size
[
1
]
-
80
))
self
.
db
=
wx
.
Button
(
self
,
label
=
"Delete"
,
pos
=
(
300
,
size
[
1
]
-
55
))
self
.
db
=
wx
.
Button
(
self
,
label
=
"Delete"
,
pos
=
(
300
,
size
[
1
]
-
55
))
self
.
ab
=
wx
.
Button
(
self
,
label
=
"Auto"
,
pos
=
(
300
,
size
[
1
]
-
30
))
self
.
ab
=
wx
.
Button
(
self
,
label
=
"Auto"
,
pos
=
(
300
,
size
[
1
]
-
30
))
self
.
lb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
load
)
self
.
lb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
right
)
self
.
eb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
export
)
self
.
eb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
export
)
self
.
sb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
snap
)
self
.
sb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
snap
)
self
.
cb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
center
)
self
.
cb
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
center
)
...
@@ -72,32 +72,6 @@ class showstl(wx.Window):
...
@@ -72,32 +72,6 @@ class showstl(wx.Window):
self
.
l
.
Select
(
self
.
l
.
GetCount
()
-
1
)
self
.
l
.
Select
(
self
.
l
.
GetCount
()
-
1
)
self
.
Refresh
()
self
.
Refresh
()
def
load
(
self
,
event
):
dlg
=
wx
.
FileDialog
(
self
,
"Pick file to load"
,
self
.
basedir
,
style
=
wx
.
FD_OPEN
|
wx
.
FD_FILE_MUST_EXIST
)
dlg
.
SetWildcard
(
"OpenSCAD files (;*.scad;)"
)
self
.
models
=
{}
if
(
dlg
.
ShowModal
()
==
wx
.
ID_OK
):
name
=
dlg
.
GetPath
()
lf
=
open
(
name
)
s
=
[
i
.
replace
(
"
\n
"
,
""
)
.
replace
(
"
\r
"
,
""
)
.
replace
(
";"
,
""
)
for
i
in
lf
]
lf
.
close
()
for
i
in
s
:
parts
=
i
.
split
()
translate_list
=
eval
(
parts
[
0
])
rotate_list
=
eval
(
parts
[
1
])
stl_file
=
eval
(
parts
[
2
])
newname
=
os
.
path
.
split
(
stl_file
.
lower
())[
1
]
c
=
1
while
newname
in
self
.
models
:
newname
=
os
.
path
.
split
(
stl_file
.
lower
())[
1
]
newname
=
newname
+
"(
%
d)"
%
c
c
+=
1
stl_path
=
os
.
path
.
join
(
os
.
path
.
split
(
name
)[
0
:
len
(
os
.
path
.
split
(
stl_file
))
-
1
])
stl_full_path
=
os
.
path
.
join
(
stl_path
[
0
],
str
(
stl_file
))
self
.
load_stl
(
stl_full_path
,
stl_file
,
translate_list
,
rotate_list
[
2
])
def
export
(
self
,
event
):
def
export
(
self
,
event
):
dlg
=
wx
.
FileDialog
(
self
,
"Pick file to save to"
,
self
.
basedir
,
style
=
wx
.
FD_SAVE
)
dlg
=
wx
.
FileDialog
(
self
,
"Pick file to save to"
,
self
.
basedir
,
style
=
wx
.
FD_SAVE
)
dlg
.
SetWildcard
(
"STL files (;*.stl;)"
)
dlg
.
SetWildcard
(
"STL files (;*.stl;)"
)
...
@@ -159,10 +133,38 @@ class showstl(wx.Window):
...
@@ -159,10 +133,38 @@ class showstl(wx.Window):
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
,
"
Pick file to load
"
,
self
.
basedir
,
style
=
wx
.
FD_OPEN
|
wx
.
FD_FILE_MUST_EXIST
)
dlg
.
SetWildcard
(
"STL files (;*.stl;)"
)
dlg
.
SetWildcard
(
"STL files (;*.stl;)
|*.stl|OpenSCAD files (;*.scad;)|*.scad
"
)
if
(
dlg
.
ShowModal
()
==
wx
.
ID_OK
):
if
(
dlg
.
ShowModal
()
==
wx
.
ID_OK
):
name
=
dlg
.
GetPath
()
name
=
dlg
.
GetPath
()
if
(
name
.
lower
()
.
endswith
(
".stl"
)):
self
.
load_stl
(
event
,
name
)
elif
(
name
.
lower
()
.
endswith
(
".scad"
)):
self
.
load_scad
(
event
,
name
)
def
load_scad
(
self
,
event
,
name
):
lf
=
open
(
name
)
s
=
[
i
.
replace
(
"
\n
"
,
""
)
.
replace
(
"
\r
"
,
""
)
.
replace
(
";"
,
""
)
for
i
in
lf
]
lf
.
close
()
self
.
models
=
{}
for
i
in
s
:
parts
=
i
.
split
()
translate_list
=
eval
(
parts
[
0
])
rotate_list
=
eval
(
parts
[
1
])
stl_file
=
eval
(
parts
[
2
])
newname
=
os
.
path
.
split
(
stl_file
.
lower
())[
1
]
c
=
1
while
newname
in
self
.
models
:
newname
=
os
.
path
.
split
(
stl_file
.
lower
())[
1
]
newname
=
newname
+
"(
%
d)"
%
c
c
+=
1
stl_path
=
os
.
path
.
join
(
os
.
path
.
split
(
name
)[
0
:
len
(
os
.
path
.
split
(
stl_file
))
-
1
])
stl_full_path
=
os
.
path
.
join
(
stl_path
[
0
],
str
(
stl_file
))
self
.
load_stl_into_model
(
stl_full_path
,
stl_file
,
translate_list
,
rotate_list
[
2
])
def
load_stl
(
self
,
event
,
name
):
if
not
(
os
.
path
.
exists
(
name
)):
if
not
(
os
.
path
.
exists
(
name
)):
return
return
path
=
os
.
path
.
split
(
name
)[
0
]
path
=
os
.
path
.
split
(
name
)[
0
]
...
@@ -171,11 +173,11 @@ class showstl(wx.Window):
...
@@ -171,11 +173,11 @@ class showstl(wx.Window):
#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.
self
.
load_st
l
(
name
,
name
)
self
.
load_stl_into_mode
l
(
name
,
name
)
self
.
Refresh
()
self
.
Refresh
()
#print time.time()-t
#print time.time()-t
def
load_stl
(
self
,
path
,
name
,
offset
=
[
0
,
0
,
0
],
rotation
=
0
):
def
load_stl
_into_model
(
self
,
path
,
name
,
offset
=
[
0
,
0
,
0
],
rotation
=
0
):
newname
=
os
.
path
.
split
(
name
.
lower
())[
1
]
newname
=
os
.
path
.
split
(
name
.
lower
())[
1
]
c
=
1
c
=
1
while
newname
in
self
.
models
:
while
newname
in
self
.
models
:
...
...
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