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
b8d04d18
Commit
b8d04d18
authored
Jul 12, 2011
by
kliment
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First semi-working version of plater. Only works with ascii stl files for now
parent
ffb151b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
4 deletions
+34
-4
plater.py
plater.py
+16
-2
stltool.py
stltool.py
+18
-2
No files found.
plater.py
View file @
b8d04d18
...
@@ -12,10 +12,12 @@ class stlwrap:
...
@@ -12,10 +12,12 @@ class stlwrap:
return
self
.
name
return
self
.
name
class
showstl
(
wx
.
Frame
):
class
showstl
(
wx
.
Window
):
def
__init__
(
self
,
parent
,
size
,
pos
):
def
__init__
(
self
,
parent
,
size
,
pos
):
wx
.
Window
.
__init__
(
self
,
parent
,
size
=
size
,
pos
=
pos
)
wx
.
Window
.
__init__
(
self
,
parent
,
size
=
size
,
pos
=
pos
)
self
.
l
=
wx
.
ListCtrl
(
self
,
size
=
(
300
,
100
),
pos
=
(
0
,
size
[
1
]
-
100
))
self
.
l
=
wx
.
ListCtrl
(
self
,
size
=
(
300
,
100
),
pos
=
(
0
,
size
[
1
]
-
100
))
self
.
b
=
wx
.
Button
(
self
,
label
=
"Export"
,
pos
=
(
300
,
size
[
1
]
-
100
))
self
.
b
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
export
)
#self.SetBackgroundColour((0,0,0))
#self.SetBackgroundColour((0,0,0))
wx
.
FutureCall
(
200
,
self
.
paint
)
wx
.
FutureCall
(
200
,
self
.
paint
)
self
.
i
=
0
self
.
i
=
0
...
@@ -30,6 +32,18 @@ class showstl(wx.Frame):
...
@@ -30,6 +32,18 @@ class showstl(wx.Frame):
self
.
initpos
=
None
self
.
initpos
=
None
self
.
prevsel
=-
1
self
.
prevsel
=-
1
def
export
(
self
,
event
):
dlg
=
wx
.
FileDialog
(
self
,
"Pick file to save to"
,
self
.
basedir
,
style
=
wx
.
FD_SAVE
)
dlg
.
SetWildcard
(
"STL files (;*.stl;)"
)
if
(
dlg
.
ShowModal
()
==
wx
.
ID_OK
):
name
=
dlg
.
GetPath
()
facets
=
[]
for
i
in
self
.
models
.
values
():
facets
+=
i
.
facets
stltool
.
emitstl
(
name
,
facets
,
"plater_export"
)
print
"wrote "
,
name
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;)"
)
...
@@ -120,7 +134,7 @@ class showstl(wx.Frame):
...
@@ -120,7 +134,7 @@ class showstl(wx.Frame):
class
stlwin
(
wx
.
Frame
):
class
stlwin
(
wx
.
Frame
):
def
__init__
(
self
,
size
=
(
500
,
600
)):
def
__init__
(
self
,
size
=
(
500
,
600
)):
wx
.
Frame
.
__init__
(
self
,
None
,
size
=
size
)
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
"Right-click to add a file"
,
size
=
size
)
self
.
s
=
showstl
(
self
,(
500
,
600
),(
100
,
100
))
self
.
s
=
showstl
(
self
,(
500
,
600
),(
100
,
100
))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
stltool.py
View file @
b8d04d18
...
@@ -24,6 +24,22 @@ m=[
...
@@ -24,6 +24,22 @@ m=[
[
0
,
0
,
0
,
1
]
[
0
,
0
,
0
,
1
]
]
]
def
emitstl
(
filename
,
facets
=
[],
objname
=
"stltool_export"
):
if
filename
is
None
:
return
f
=
open
(
filename
,
"w"
)
f
.
write
(
"solid "
+
objname
+
"
\n
"
)
for
i
in
facets
:
f
.
write
(
" facet normal "
+
" "
.
join
(
map
(
str
,
i
[
0
]))
+
"
\n
outer loop
\n
"
)
for
j
in
i
[
1
]:
f
.
write
(
" vertex "
+
" "
.
join
(
map
(
str
,
j
))
+
"
\n
"
)
f
.
write
(
" endloop"
+
"
\n
"
)
f
.
write
(
" endfacet"
+
"
\n
"
)
f
.
write
(
"endsolid "
+
objname
+
"
\n
"
)
f
.
close
()
class
stl
:
class
stl
:
def
__init__
(
self
,
filename
=
None
):
def
__init__
(
self
,
filename
=
None
):
self
.
facet
=
[[
0
,
0
,
0
],[[
0
,
0
,
0
],[
0
,
0
,
0
],[
0
,
0
,
0
]]]
self
.
facet
=
[[
0
,
0
,
0
],[[
0
,
0
,
0
],[
0
,
0
,
0
],[
0
,
0
,
0
]]]
...
@@ -112,7 +128,7 @@ class stl:
...
@@ -112,7 +128,7 @@ class stl:
f
.
write
(
" vertex "
+
" "
.
join
(
map
(
str
,
j
))
+
"
\n
"
)
f
.
write
(
" vertex "
+
" "
.
join
(
map
(
str
,
j
))
+
"
\n
"
)
f
.
write
(
" endloop"
+
"
\n
"
)
f
.
write
(
" endloop"
+
"
\n
"
)
f
.
write
(
" endfacet"
+
"
\n
"
)
f
.
write
(
" endfacet"
+
"
\n
"
)
f
.
write
(
"endsolid
exported"
+
"
\n
"
)
f
.
write
(
"endsolid
"
+
self
.
name
+
"
\n
"
)
f
.
flush
()
f
.
flush
()
def
parseline
(
self
,
l
):
def
parseline
(
self
,
l
):
...
@@ -156,5 +172,5 @@ if __name__=="__main__" and 0:
...
@@ -156,5 +172,5 @@ if __name__=="__main__" and 0:
break
break
print
i
,
len
(
working
)
print
i
,
len
(
working
)
emitstl
(
"sphereout.stl"
,
s
.
facets
,
"emitted_object"
)
#stl("../prusamendel/stl/mendelplate.stl")
#stl("../prusamendel/stl/mendelplate.stl")
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