CalcTree Help Pages
  • What is CalcTree?
  • Getting started
    • CalcTree Pages
    • Create a CalcTree Page
    • Add a calculation
    • Collaborate with a colleague
  • Calculations
    • Parameters
      • Math formulas
        • Parameter Data Types
        • Native Functions
          • Arithmetic Functions
          • Trigonometric Functions
          • Logical & Comparison Functions
          • Matrix & Vector Functions
          • Probability & Combinatorics Functions
          • Statistical Functions
          • String Functions
          • Utility Functions
          • Other Native Functions
        • Valid Expression Syntax
      • Supported Units
      • Dropdown List Parameters
        • Linking CSV Data to Dependent Dropdowns in CalcTree
      • Parameter Settings
    • Integrations
      • Python in CalcTree
        • Adding a Python Source
        • Defining Parameters in Python
        • Referencing Other Parameters in Python
        • Working with Units in Python
        • Creating Tables and Visuals in Python
        • Consuming Files in Python
        • Using Pre-installed Python Libraries
      • Spreadsheets [Coming Soon!]
      • File Upload
        • CSV files
      • 3rd Party Software Plugins
        • Excel
        • Grasshopper
        • ETABS [v20 & v21]
        • ETABS [v22]
        • SAP 2000
        • CSI Bridge [v26]
    • Templates [Coming Soon!]
    • Optimising your calculations
  • Pages & Reports
    • CalcTree Documents
    • Static content
    • Parametric content
      • Parametric equation
      • Inputs
      • Outputs
  • Export to PDF
  • API
    • GraphQL API
      • Generating an API key
      • Queries
        • GetCalculation
        • Calculate
      • Examples
        • Bulk calculations with Python
  • Collaborate
    • Add members
    • Review and approval
    • Add stakeholders
  • Administrate
    • CalcTree Workspace
    • Versioning and Audit trail
  • CalcTree for System Administrators
Powered by GitBook
On this page
  • Key Benefits
  • Typical Use Cases
  • Next Steps
  1. Calculations
  2. Integrations

Python in CalcTree

Create Python-powered functionality and integrate it to your page with zero setup.

PreviousIntegrationsNextAdding a Python Source

Last updated 1 day ago

CalcTree allows you to write and run Python scripts as part of your engineering calculations. There is no need to install development tools, manage environments, or configure deployment—everything runs in the cloud.

Use Python when you need more flexibility than standard formulas provide, or when your work involves data manipulation, units, visualisation, or access to engineering libraries.

Key Benefits

  • Write actual Python code Use familiar syntax and control structures to perform calculations.

  • Access engineering libraries Instantly use such as numpy, matplotlib, sectionproperties, anaStruct, BeamBending, and many more.

  • Work with units Use ct.quantity() to interact with unit-aware calculations on your page. Automatically enforce unit consistency between values.

  • Generate visuals Produce plots and diagrams using matplotlib and embed them directly in your CalcTree pages.

  • Link to other sources Reference parameters from other blocks—including MathJS, tables, and spreadsheets—within your Python script.

Typical Use Cases

  • Generate diagrams and chart plots with Python and matplotlib

  • Run heavier analysis like FEA by using libraries such as opensees.py

  • Extract and interact with data from files uploaded to CalcTree pages

  • Run a loop across various input instances and generate output scenarios

Next Steps

To get started, continue with:

pre-installed Python libraries
Adding a Python source
Defining parameters
Referencing other parameters in Python
Working with units
Creating tables and visuals
Consuming files
Using pre-installed Python libraries