Skip to content

Commit eef9874

Browse files
committed
flaked
1 parent f64e897 commit eef9874

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/ceasiompy/stl2cpacs/stl2cpacs.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# IMPORTS
55
# =================================================================================================
66

7-
from pathlib import Path
87
import numpy as np
98
import os
109
import struct
@@ -20,7 +19,7 @@ def export_mesh(tri_filename, stl_filename, name):
2019
"""
2120
Direct STL → TRI converter.
2221
"""
23-
22+
2423
if not os.path.exists(stl_filename):
2524
raise FileNotFoundError(f"STL not found: {stl_filename}")
2625

@@ -170,13 +169,13 @@ def cpacs_component_detection(stl_file) -> list:
170169

171170

172171
def load_stl_auto(path):
173-
172+
174173
with open(path, "rb") as f:
175174
start = f.read(80)
176175
if start[:5].lower() == b"solid":
177176
try:
178177
return read_ascii_stl(path)
179-
except:
178+
except ValueError:
180179
return read_binary_stl(path)
181180
return read_binary_stl(path)
182181

@@ -185,7 +184,7 @@ def write_cart3d_tri(filename, triangles):
185184
"""
186185
Saves triangles to Cart3D .tri format
187186
"""
188-
187+
189188
verts = triangles.reshape(-1, 3)
190189
uniq, inverse = np.unique(verts, axis=0, return_inverse=True)
191190
tri_idx = inverse.reshape(-1, 3) + 1 # 1-based indices

0 commit comments

Comments
 (0)