domthom21 / eurocodedesign

Typed python framework for eurocode calculations
https://eurocodedesign.readthedocs.io/
Mozilla Public License 2.0
5 stars 1 forks source link

[ENH] Stepper #30

Closed domthom21 closed 1 year ago

domthom21 commented 1 year ago

Is your feature request related to a problem? Please describe. We want to make calculation steps and similar from eurocode be printable/visible in notebooks with pretty printing.

Describe the solution you'd like We add a module named "stepper". which has a factory method get to get a Stepper object. For each step, a string is added. The string can also contain latex commands.

from eurocodedesign import stepper
with stepper.get() as st:
    # do stuff
    st.step(f"Steel section {section} has height {height} and width {width}.")
    # do stuff
    st.step(f"Because of {x}, {section} is of cross-section type {QK}.")

Output: Steel section IPE320 has height 22 mm and width 12 mm. Because of height/width, IPE320 is of cross-section type QK3.

Describe alternatives you've considered No other alterntives were thought of.

Additional context Stepper will use __enter__ and __exit__ to be usable in with blocks. See https://stackoverflow.com/questions/1984325/explaining-pythons-enter-and-exit

Later, the jupter notebooks should be transformable with https://quarto.org/docs/gallery/ to nice reports. Mainly pdf, but word or html are also possible.

domthom21 commented 1 year ago

see #34 for further suggestions