Optimising your calculations
Tips and tricks on how to optimise your calculation pages.
To ensure your pages are fast, responsive, and easy to maintain, we recommend the following best practices when building calculations and reports:
Keep Page Size Manageable
Avoid building a single, oversized page that includes all aspects of your project. Instead:
Break your work into multiple pages (e.g. input summary, structural checks, charts/reporting).
Link pages together using subpages or workspace structure for modularity and clarity. [Cross page linking of parameter feature is coming soon].
Use Native Math Where Possible
Where you can, stick to native math notation and parameter definitions (i.e. mathjs formulas) in the page. These run faster and allow you to build dynamic, pretty, math notation.
Keep Python Code Sources Lightweight
If you're using Python for more complex functions, data manipulation or charting:
Avoid loading large libraries
For example, if you’re just reading and using table data, you likely don’t need pandas
. It adds load time and memory use—especially for small files or simple logic. Instead, use Python’s built-in csv
module:
Example: Pulling Dimensions from a Section Table
Then assign it to variables ready to be referenced in the pafe.
Keep code short
Keep and focused on a specific task (e.g. chart generation, table parsing). Create a new code source for different tasks.
Use Functions in Python
Where appropriate, move logic into Python functions to reduce clutter. Instead of defining several math variables which aren't all needed in your page, like this:
You can wrap the logic into a Python function:
Then define a single variable, which you can reference from page parameters:
Why This Helps
You hide complexity in the Python code, keeping your page cleaner.
You reduce the number of intermediate parameters (e.g.
phi
,alpha_2
) cluttering your UI.You can re-use the same function across multiple pages or checks (e.g. for T-beams, doubly reinforced sections, etc.).
You maintain flexibility to edit formulas in one place.
Last updated