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
c312d850
Commit
c312d850
authored
Jul 04, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup
parent
b3e27469
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
stltool.py
printrun/stltool.py
+11
-12
No files found.
printrun/stltool.py
View file @
c312d850
...
@@ -88,7 +88,7 @@ def emitstl(filename, facets = [], objname = "stltool_export", binary = 1):
...
@@ -88,7 +88,7 @@ def emitstl(filename, facets = [], objname = "stltool_export", binary = 1):
class
stl
:
class
stl
(
object
)
:
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
]]]
self
.
facets
=
[]
self
.
facets
=
[]
...
@@ -113,27 +113,26 @@ class stl:
...
@@ -113,27 +113,26 @@ class stl:
print
"Not an ascii stl solid - attempting to parse as binary"
print
"Not an ascii stl solid - attempting to parse as binary"
f
=
open
(
filename
,
"rb"
)
f
=
open
(
filename
,
"rb"
)
buf
=
f
.
read
(
84
)
buf
=
f
.
read
(
84
)
while
(
len
(
buf
)
<
84
)
:
while
len
(
buf
)
<
84
:
newdata
=
f
.
read
(
84
-
len
(
buf
))
newdata
=
f
.
read
(
84
-
len
(
buf
))
if
not
len
(
newdata
):
if
not
len
(
newdata
):
break
break
buf
+=
newdata
buf
+=
newdata
facetcount
=
struct
.
unpack_from
(
"<I"
,
buf
,
80
)
facetcount
=
struct
.
unpack_from
(
"<I"
,
buf
,
80
)
facetformat
=
struct
.
Struct
(
"<ffffffffffffH"
)
facetformat
=
struct
.
Struct
(
"<ffffffffffffH"
)
for
i
in
xrange
(
facetcount
[
0
]):
for
i
in
xrange
(
facetcount
[
0
]):
buf
=
f
.
read
(
50
)
buf
=
f
.
read
(
50
)
while
(
len
(
buf
)
<
50
)
:
while
len
(
buf
)
<
50
:
newdata
=
f
.
read
(
50
-
len
(
buf
))
newdata
=
f
.
read
(
50
-
len
(
buf
))
if
not
len
(
newdata
):
if
not
len
(
newdata
):
break
break
buf
+=
newdata
buf
+=
newdata
fd
=
list
(
facetformat
.
unpack
(
buf
))
fd
=
list
(
facetformat
.
unpack
(
buf
))
self
.
name
=
"binary soloid"
self
.
name
=
"binary soloid"
self
.
facet
=
[
fd
[:
3
],[
fd
[
3
:
6
],
fd
[
6
:
9
],
fd
[
9
:
12
]]]
facet
=
[
fd
[:
3
],[
fd
[
3
:
6
],
fd
[
6
:
9
],
fd
[
9
:
12
]]]
self
.
facets
+=
[
self
.
facet
]
self
.
facets
.
append
(
facet
)
facet
=
self
.
facet
self
.
facetsminz
.
append
((
min
(
map
(
lambda
x
:
x
[
2
],
facet
[
1
])),
facet
))
self
.
facetsminz
+=
[(
min
(
map
(
lambda
x
:
x
[
2
],
facet
[
1
])),
facet
)]
self
.
facetsmaxz
.
append
((
max
(
map
(
lambda
x
:
x
[
2
],
facet
[
1
])),
facet
))
self
.
facetsmaxz
+=
[(
max
(
map
(
lambda
x
:
x
[
2
],
facet
[
1
])),
facet
)]
f
.
close
()
f
.
close
()
return
return
...
...
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