Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/save to ascii bugfix #229

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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