Closed user27182 closed 3 weeks ago
Found a solution to this, should I open a pull request although it's a small change?
It changes the format for bounds attributes in the MultiBlock class
attrs.append(('X Bounds', (bds[0], bds[1]), '{:.3f}, {:.3f}'))
becomes
attrs.append(('X Bounds', (bds[0], bds[1]), '{:.3E}, {:.3E}'))
And example output:
Python 3.12.6 (main, Sep 30 2024, 18:04:18) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyvista
>>> empty_mesh = pyvista.PolyData().extract_cells(0)
>>> blocks = pyvista.MultiBlock([empty_mesh])
>>> print(blocks)
MultiBlock (0x11b77b100)
N Blocks 1
X Bounds 1.000E+299, -1.000E+299
Y Bounds 1.000E+299, -1.000E+299
Z Bounds 1.000E+299, -1.000E+299
>>>
@TimeTravelerFromNow We are happy to have your contribution!
Describe the bug, what's wrong, and what you expected.
The
repr
for a dataset likePolyData
,UnstructuredGrid
, etc uses scientific notation to format the bounds. ButMultiBlock
does not. This is made abundantly clear in the example below where 300+ digits are shown for each multiblock bound. The bounds formatting in theMultiBlock
boundsrepr
is expected to match the non-multiblock formatting.Steps to reproduce the bug.
EDIT: This bug is not specific to empty meshes. It applies generally to any multiblock bounds.
System Information
Screenshots
No response