## Calculations

Blockpad calculations use spreadsheet style formulas, but with more functionality like math with units, named values, matrices, and more.

#### Start a new document

First things first. Create a new Blockpad file and select *New Document*.

#### Dynamic equations

Dynamic equations act like spreadsheet formulas, but in a document. The input is highlighted blue, and the calculated section is purple.

###### Insert a dynamic equation:

- Type an equals sign.
- Type in a formula.
- Press the enter key.

- To edit an equation, double click. You can also select it and press the spacebar.
- To exit an equation, press ESC.

##### Entering and viewing equations

Equations are entered exactly like a formula in a spreadsheet, but they appear in mathematical notation.

#### Unit tracking

Numbers in a formula/dynamic equation can have units assigned to them.

To assign a unit, type the unit text after the number.

The unit text must match what is stored in the Blockpad library, but Blockpad will often auto correct to what's intended. The dropdown selection will also help.

For compound units like ft-lb, m^3/min, or ft/s, use math operators like *, /, or ^.

##### Blockpad handles unit arithmetic

The formula will convert, multiply, and cancel the units as necessary.

##### Convert units

To convert a value to a different unit, type "to" and the desired units.

This sometimes needs to be done at the end of a calculation, because the units will not always auto-cancel.

##### Incompatible units

If units are incompatible, the equation will calculate, but it will show a question mark instead of the unit and an error on the equation.

##### Foot-inch units

Blockpad supports ft-in units. So, 4 ft 3 in is a legitimate number value, which can be used in calculations. To convert to ft-in units, type "to ft in" after a value.

There are other similar units:

- deg min sec (angle)
- day hr min
- day hr min sec
- hr min sec
- hr min
- min sec

##### Make numbers unitless

Sometimes calculations require you to strip units from a number, often in formulas that come from empirical studies.

To strip out units, divide the value by the number 1 with the units the value is assumed to be. If the value has compatible units it will do any conversions automatically.

To assign units to a unitless value, multiply the value by 1 with the unit you want to add. You can convert again using "to unit" described above.

You can do this inside of equations as necessary.

For more information on Blockpad units, including a full list, check out our website: Units.

#### Value names

In Blockpad, formula/dynamic equation results are stored in the file as values. These values can be given names so you can reference them in other formulas.

###### Name a value:

- In a dynamic equation, type the name at the beginning.
- Type an equals sign.
- Type the calculation for the formula.

Values are created with calculations or just typing the value into the formula.

*As a side note, you can also save values to a library
and use them in multiple files.*

##### Reference unnamed values

You can reference values with no name. Blockpad will create the name for you. If you try to reference a value using copy reference or click functionality (see Referencing a value below), then Blockpad will auto-assign a name to that value.

##### Text values

Values can also be text. To create a text value, use quotation marks (") or apostrophes (') to begin and end the text.

##### Other value types

Values can also be dates, arrays, complex numbers, and more. See the sections below for more information.

##### Referencing a value

There are three ways to specify a value reference in a formula.

The primary option is to click on the value like clicking on a spreadsheet cell.

The second option is to use the copy reference tool.

You can also just type the name in. The dropdown will help you out.

*A location in front of the name with dot notation may be needed if the value is in a different frame.
When in doubt, clicking and copy reference can always be used.
See frames for more information about location and value containers.*

##### Value name rules

- Names consist of text, numbers and some kinds of symbols.
- Names cannot begin with numbers.
- Underscore (_) and dollar sign ($) are allowed symbols.
- Spaces are allowed.
- Names are case sensitive but will auto-correct to the correct case if there are no conflicts.
- Avoid using names similar to spreadsheet cell references (e.g. A5, D150, or BR559).

##### Names used multiple times

If the same name is used more than once in a frame, Blockpad will show an error where that name is referenced.

*This is because Blockpad works like a spreadsheet in terms of dependencies,
so you can use a value from anywhere in the document (above or below).
To redefine a value (like in programs such as Mathcad), you can use
step-by-step sections.*

##### Renaming and auto-updated references

If a value is renamed, references to that value will update to the new name. The reference won't be broken.

##### Built in values

There are a few built-in number values. To use them, type the name into an equation like a normal value.

- pi or π (3.1415...)
- e (2.718...)
- i (the square root of negative one)

#### Show steps and more

You can show different parts of a dynamic equation to control what information is visible.

You can show and hide:

- the value name
- the calculation
- the result
- the steps (shows values plugged in)

You can also choose to view the equation as multiple lines and turn the math layout off.

###### Show or hide formula properties:

- Select a dynamic equation.
- Open the properties window.
- Under
*Formula*> near the bottom, toggle the property you wish to change.

Show steps and separate lines.

Hide the calculation.

Hide name and result, show steps.

Hide name and formula.

#### Value formatting

Just like in conventional spreadsheets, Blockpad gives you options for how to display values, like number of decimals, scientific notation, etc. Blockpad offers more options too, like number of significant figures to display or fractions with a specified denominator.

There are a few value format options directly in the toolbar, like fraction or scientific notation, but there are more options in the value format window.

###### Specify value format:

- Select the values you wish to format.
- In the toolbar, select the
*Value Format*icon. - Select an option for the number display.
- There are more settings at the bottom of the window.
- Click OK.

Note that the value format doesn't affect the actual number stored in Blockpad, which is always in decimal format like in conventional spreadsheets.

For example, all of the values below are stored the same in Blockpad, even though the formula result on the far right is shown in sixteenths.

Learn more about value formats here.

#### Table of Contents

- Drawing inside a document or file
- Drawing objects
- Lines, points, and shapes
- Text labels
- Linear dimension labels
- Textboxes
- Images
- Selecting multiple objects
- Ordering objects
- Using the point snapping
- Points you can snap to
- Horizontal and vertical from points
- Parallel or perpendicular lines
- Point snap options
- Transformations - resizing and moving
- Format drawings
- Keyboard input and canvas scales

- Top level frames
- Frames in Frames
- Value containers and location
- Frames and sections are containers
- Containers inside containers
- Dot notation to specify a value in a container
- Capture values

- What is a block?
- Block example
- Use the block results
- Block inputs
- View block as table
- Block instances and block definitions
- More examples
- Create a block
- When to make a block
- Make a block with Blockpad calculations
- Update a block definition
- Create a block using scripts
- Block tables

- Examples library
- Use library items in a document
- Use the long form library item name
- Assign a shortcut name to the library
- Include a library in a file
- Use a library number value
- Use a library function
- Use items in a library frame
- Use a library data table as function
- Use library blocks
- Core, built-in, and subscription libraries
- Create personal libraries
- Save items to your library
- Manage your library online
- Library subscriptions