Skip to content

Commit

Permalink
Merge pull request #229 from JBil8/feature/save_to_ascii_bugfix
Browse files Browse the repository at this point in the history
Feature/save to ascii bugfix
  • Loading branch information
wolph authored Nov 25, 2024
2 parents c1ce8b5 + 88cec8d commit 688d249
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions stl/stl.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,14 @@ def p(s, file):
p('solid %s' % name, file=fh)

for row in self.data:
# Explicitly convert each component to standard float for normals and vertices
normals = tuple(float(n) for n in row['normals'])
vectors = row['vectors']
p(
'facet normal %r %r %r' % tuple(row['normals'].tolist()),
file=fh,
)
p('facet normal %f %f %f' % normals, file=fh)
p(' outer loop', file=fh)
p(' vertex %r %r %r' % tuple(vectors[0].tolist()), file=fh)
p(' vertex %r %r %r' % tuple(vectors[1].tolist()), file=fh)
p(' vertex %r %r %r' % tuple(vectors[2].tolist()), file=fh)
p(' vertex %f %f %f' % tuple(float(v) for v in vectors[0]), file=fh)
p(' vertex %f %f %f' % tuple(float(v) for v in vectors[1]), file=fh)
p(' vertex %f %f %f' % tuple(float(v) for v in vectors[2]), file=fh)
p(' endloop', file=fh)
p('endfacet', file=fh)

Expand Down

0 comments on commit 688d249

Please sign in to comment.