---- meshio-5.3.5_ref/src/meshio/nastran/_nastran.py 2024-01-31 16:09:01.000000000 +0100
-+++ meshio-5.3.5_dev/src/meshio/nastran/_nastran.py 2024-09-30 15:59:26.751404661 +0200
-@@ -410,7 +410,7 @@
+--- meshio-5.3.5-ref/src/meshio/nastran/_nastran.py 2024-01-31 16:09:01.000000000 +0100
++++ meshio-5.3.5-dev/src/meshio/nastran/_nastran.py 2024-10-28 14:03:45.432868000 +0100
+@@ -17,6 +17,7 @@
+ "CELAS1": "vertex",
+ "CBEAM": "line",
+ "CBUSH": "line",
++ "CBEAM3": "line3",
+ "CBUSH1D": "line",
+ "CROD": "line",
+ "CGAP": "line",
+@@ -347,7 +348,11 @@
+ for ict, cell_block in enumerate(mesh.cells):
+ cell_type = cell_block.type
+ cells = cell_block.data
+- nastran_type = meshio_to_nastran_type[cell_type]
++ try:
++ nastran_type = meshio_to_nastran_type[cell_type]
++ except KeyError:
++ warn(f" Illegal ANSYS cell type '{cell_type}' => Skipping it.")
++ continue
+ if cell_format.endswith("-large"):
+ nastran_type += "*"
+ if cell_refs is not None:
+@@ -410,10 +415,16 @@
-0.1234 --> "-1.234E-1"
3.1415926535897932 --> "3.14159265359E+0"
"""
- out = np.format_float_scientific(value, exp_digits=1, precision=11).replace(
-+ out = np.format_float_scientific(value, exp_digits=1, precision=9).replace(
- "e", "E"
- )
- assert len(out) <= 16
+- "e", "E"
+- )
+- assert len(out) <= 16
++ k=0
++ # decrease precision if needed to keep the number of characters <= length
++ # for instance, for negative numbers and two decimal exponent, we need to decrease precision to 9
++ # e.g. value=-1.123456454678e10
++ # out='-1.123456455E+10'
++ while k==0 or len(out)>length:
++ out = np.format_float_scientific(value, exp_digits=1, precision=11-k)
++ k+=1
++ out = out.replace("e", "E")
++ assert len(out) <= length
+ return out
+ # The following is the manual float conversion. Keep it around for a while in case
+ # we still need it.