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
  1. Getting started

Add a calculation

Create your first calculation

PreviousCreate a CalcTree PageNextCollaborate with a colleague

Last updated 5 months ago

Let's use Python to create a calculation. From the right-hand panel, click on Code :

A Python source will be added to the page. The Python editor slides in from bottom of the view showing this new Python source:

The Python source initially contains guide comments in green color and a line of code. Remove these initial lines:

Click inside the code editor and then press cntrl + a -> delete keys

Click inside the code editor and then press cmd + A -> delete keys

Now type in these two Python lines inside the Python editor:

a = 2
b = a + 2

Notice that two parameters of a and b will appear on the right-hand panel, under the Python source, each sowing their current calculated value:

You've just created your first source and parameters! Try changing first line of the Python source from a = 2 to a = 3 and see that parameter b gets recalculated.

You won't need to edit the Python source for inputting different values of parameter a. By defining math parameters in the document area, you can provide input to Python sources, without opening the source. To learn how read: Parametric equation

The power of parameters are in creating parametric content. Click on the three dot menu of parameter b on the right-hand panel and select Insert parameter to create a parametric element that represents parameter b inside the document:

You can add some explanatory text around the parametric element:

We've just created a single-value parametric content that represents the value of parameter b .

Learn about different types of Parametric content:

Add documentation

Parametric content