You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def read(filename):
with open_file(filename, "rb") as f:
# Checking if the file is ASCII format is normally done by checking if the
# first 5 characters of the header is "solid".
# ```
# header = f.read(80).decode()
# ```
# Unfortunately, there are mesh files out there which are binary and still put
# "solid" there.
# A suggested alternative is to pretend the file is binary, read the
# num_triangles and see if it matches the file size
# (https://stackoverflow.com/a/7394842/353337).
filesize_bytes = os.path.getsize(filename)
if filesize_bytes < 80:
return _read_ascii(f)
f.read(80)
num_triangles = np.fromfile(f, count=1, dtype="<u4")[0]
# for each triangle, one has 3 float32 (facet normal), 9 float32 (facet),
# and 1 int16 (attribute count), 50 bytes in total
if 84 + num_triangles * 50 == filesize_bytes:
E FloatingPointError: overflow encountered in scalar multiply
Reading ASCII file as a binary looks like a dangerous thing. A try catch block should be able to deal with issue.
The text was updated successfully, but these errors were encountered:
Hi all. Here is a bug which appeared when switching from numpy 1.x to numpy 2.2.6. It can be created with the basic example from doc
Thre error raises here
https://github.com/nschloe/meshio/blame/b2ee99842e119901349fdeee06b5bf61e01f450a/src/meshio/stl/_stl.py#L40
E FloatingPointError: overflow encountered in scalar multiply
Reading ASCII file as a binary looks like a dangerous thing. A try catch block should be able to deal with issue.
The text was updated successfully, but these errors were encountered: