Skip to content

Commit

Permalink
Merge pull request #177 from simright/fix.solid_name
Browse files Browse the repository at this point in the history
make Mesh.name effective as the name after "solid" in ASCII mode
  • Loading branch information
wolph committed Sep 1, 2021
2 parents 3002a27 + 87e572a commit 6b1a36b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions stl/stl.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,16 @@ def save(self, filename, fh=None, mode=AUTOMATIC, update_normals=True):
"File handles should be in binary mode - even when"
" writing an ASCII STL.")

name = os.path.split(filename)[-1]
name = self.name
if not name:
name = os.path.split(filename)[-1]

try:
if fh:
write(fh, name)
else:
with open(filename, 'wb') as fh:
write(fh, filename)
write(fh, name)
except IOError: # pragma: no cover
pass

Expand Down

0 comments on commit 6b1a36b

Please sign in to comment.