idaholab / MontePy

MontePy is the most user friendly Python library (API) to read, edit, and write MCNP input files.
https://www.montepy.org/
MIT License
32 stars 7 forks source link

Shortcuts (e.g., Interpolate) in geometry definitions discards some user formatting #527

Open MicahGale opened 2 months ago

MicahGale commented 2 months ago

Describe the bug

Some user formatting is lost when Geometry definition shortcuts are re-exported. This was discovered/created while fixing #489.

To Reproduce

montepy.read_input("foo.imcnp").write_problem("bar.imcnp")

MCNP input file snippet

This example is from tests\inputs\test_interp_edge.imcnp

Surface interpolate edge case$
10214   0    (1  2i  4)

1 CZ 0
2 CZ 0
3 CZ 0
4 CZ 0

This is then exported as:

10214   0    (1  2I 4 )

1 CZ 0
2 CZ 0
3 CZ 0
4 CZ 0

IMP:n 0.0

Version

Additional context

This is due to the ShortcutNode -> GeometryTree -> ShortcutNode conversion cycle.