& Construction

Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
& Manufacturing

Professional CAD/CAM tools built on Inventor and AutoCAD
Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
Professional CAD/CAM tools built on Inventor and AutoCAD
Use Math blocks to add, subtract, multiply, divide, and round numbers, as well as to find the square root and perform trigonometry functions.
Type:
Tutorial
Length:
5 min.
Transcript
00:00
The Math code blocks contain mathematical blocks to perform a variety of operations.
00:09
These include a block to create a Number Constant, a block containing Operations of arithmetic,
00:16
a block containing Square Root, along with other standard common functions,
00:22
a Trigonometry block, a Rounding block, a Remainder Of block
00:29
and a Constrain block to clamp a number to arrange between a minimum and a maximum value.
00:37
When working with mathematical code blocks,
00:41
it's important to understand the relationship between block grouping and the order of operations.
00:47
Here, we might expect the result to be thirty-six, but instead it calculates at forty.
00:54
This is because each block acts as a grouped parenthetical calculation.
00:60
Here, the same blocks are arranged with this grouping in mind to achieve the expected result of thirty-six.
01:10
Once we understand that each block represents a grouping that correlates to the standard mathematical order of operations,
01:17
we can achieve the results we expect.
01:21
Next, we'll take a look at setting up a rule to calculate the area of a wall.
01:26
First, we'll add an Inventor parameter to the model to hold the calculated square footage.
01:32
This will be used in our product definition form to display a read-only value.
01:38
In the Parameters tab of the product definition, we select Area to adopt it into the form.
01:45
This product definition has been set up to display the length and height in form messages as inches.
01:52
The message blocks have been collapsed, but can be expanded to view the contents.
01:58
Likewise, they can be collapsed again as needed.
02:03
Adding a block to make Area Read Only sets the block up for the next step of adding blocks to calculate it.
02:13
To create the calculation, the Area block is added to the canvas.
02:18
Then, the Length block is added, then copied and pasted using CTRL C and CTRL V on the keyboard.
02:26
Changing the block to Height, we're now ready to add the math Operations block and set it to Multiply.
02:33
Adding the Length and Height blocks to the Multiply block creates the Area calculation.
02:39
Using the right click External Inputs option,
02:42
wraps the block to fit in the canvas better.
02:45
And then a click of the form Update button shows the calculated area.
02:51
Next, we'll determine the diagonal measurement of the wall from corner to corner
02:55
by transforming the Pythagorean theorem to solve for length c.
03:01
An existing variable called Diagonal is used, and then the Square Root block is selected and snapped to it.
03:09
Next, the general Operations block is added twice,
03:13
and one instance is left to do addition, while the second is set to raise the value by a power of two.
03:21
Adding the Length Parameter block calculates the square value
03:25
and then the block is copied and the new block is changed to use the Height.
03:31
Both blocks are added to the Addition block to sum the results of both square parameter values.
03:37
A right click and a selection of External Inputs fits the block for easier reading.
03:45
Adding a Print block to pop up the value of Diagonal
03:48
allows the calculated corner to corner result to be displayed when the form is updated.
03:55
Getting the angles of the diagonal corners can be calculated using the Inverse Tangent Trigonometric block.
04:04
Here, we start by duplicating an existing connected block set.
04:09
Adding the Trigonometry math block and setting it to use the atan function
04:14
sets us up to quickly reuse existing code blocks from further up in the canvas.
04:20
Changing the variable from diagonal to one previously created, called angle A, completes this block rule.
04:29
Using Duplicate Connected to copy the entire block allows us to create a rule to solve for the remaining angle with ease and efficiency.
04:40
Updating the form shows us the results.
04:44
In summary, it's important to know that Math blocks evaluate as parenthetical groups
04:52
following standard order of operations.
04:55
There are numerous Math blocks to explore listed in the Math block library,
04:60
combining to allow for a rich set of mathematical calculations.
Video transcript
00:00
The Math code blocks contain mathematical blocks to perform a variety of operations.
00:09
These include a block to create a Number Constant, a block containing Operations of arithmetic,
00:16
a block containing Square Root, along with other standard common functions,
00:22
a Trigonometry block, a Rounding block, a Remainder Of block
00:29
and a Constrain block to clamp a number to arrange between a minimum and a maximum value.
00:37
When working with mathematical code blocks,
00:41
it's important to understand the relationship between block grouping and the order of operations.
00:47
Here, we might expect the result to be thirty-six, but instead it calculates at forty.
00:54
This is because each block acts as a grouped parenthetical calculation.
00:60
Here, the same blocks are arranged with this grouping in mind to achieve the expected result of thirty-six.
01:10
Once we understand that each block represents a grouping that correlates to the standard mathematical order of operations,
01:17
we can achieve the results we expect.
01:21
Next, we'll take a look at setting up a rule to calculate the area of a wall.
01:26
First, we'll add an Inventor parameter to the model to hold the calculated square footage.
01:32
This will be used in our product definition form to display a read-only value.
01:38
In the Parameters tab of the product definition, we select Area to adopt it into the form.
01:45
This product definition has been set up to display the length and height in form messages as inches.
01:52
The message blocks have been collapsed, but can be expanded to view the contents.
01:58
Likewise, they can be collapsed again as needed.
02:03
Adding a block to make Area Read Only sets the block up for the next step of adding blocks to calculate it.
02:13
To create the calculation, the Area block is added to the canvas.
02:18
Then, the Length block is added, then copied and pasted using CTRL C and CTRL V on the keyboard.
02:26
Changing the block to Height, we're now ready to add the math Operations block and set it to Multiply.
02:33
Adding the Length and Height blocks to the Multiply block creates the Area calculation.
02:39
Using the right click External Inputs option,
02:42
wraps the block to fit in the canvas better.
02:45
And then a click of the form Update button shows the calculated area.
02:51
Next, we'll determine the diagonal measurement of the wall from corner to corner
02:55
by transforming the Pythagorean theorem to solve for length c.
03:01
An existing variable called Diagonal is used, and then the Square Root block is selected and snapped to it.
03:09
Next, the general Operations block is added twice,
03:13
and one instance is left to do addition, while the second is set to raise the value by a power of two.
03:21
Adding the Length Parameter block calculates the square value
03:25
and then the block is copied and the new block is changed to use the Height.
03:31
Both blocks are added to the Addition block to sum the results of both square parameter values.
03:37
A right click and a selection of External Inputs fits the block for easier reading.
03:45
Adding a Print block to pop up the value of Diagonal
03:48
allows the calculated corner to corner result to be displayed when the form is updated.
03:55
Getting the angles of the diagonal corners can be calculated using the Inverse Tangent Trigonometric block.
04:04
Here, we start by duplicating an existing connected block set.
04:09
Adding the Trigonometry math block and setting it to use the atan function
04:14
sets us up to quickly reuse existing code blocks from further up in the canvas.
04:20
Changing the variable from diagonal to one previously created, called angle A, completes this block rule.
04:29
Using Duplicate Connected to copy the entire block allows us to create a rule to solve for the remaining angle with ease and efficiency.
04:40
Updating the form shows us the results.
04:44
In summary, it's important to know that Math blocks evaluate as parenthetical groups
04:52
following standard order of operations.
04:55
There are numerous Math blocks to explore listed in the Math block library,
04:60
combining to allow for a rich set of mathematical calculations.
Math code blocks contain mathematical blocks to perform a variety of operations. These include a Number constant block, a block with Operations of arithmetic, a block with Square Root and other common functions, a Trigonometry block, a Rounding block, a Remainder Of block, and a Constrain block to limit a number between a minimum and a maximum value.
When working with mathematical code blocks, it is important to understand the relationship between block grouping and the order of operations.
An arrangement of blocks is created with an intended result of 36, as shown in the calculation.
However, each block in the following block set acts as a grouped parenthetical calculation. When the code block is run, the result of the following configuration is 40.
The same blocks are rearranged and grouped to achieve the expected result of 36.
To set up a rule that calculates the area of a wall, first, add the Area parameter to the form:
The product definition shown below has already been set up to display the length and height in form messages as inches.
To make the Area parameter read-only:
To create the Area calculation:
The Area calculation displays in the form as a read-only value.
Next, to determine the diagonal measurement of the wall from corner to corner, transform the Pythagorean theorem to solve for length c.
A popup shows the Diagonal result.
The angles of the diagonal corners can be calculated using the Inverse Tangent Trigonometric block.
The result for the Diagonal, along with the result for Angle A and Angle B display in the popup.
In summary, Math blocks evaluate as parenthetical groups following the standard order of operations. There are numerous Math blocks that can be combined to perform a variety of mathematical calculations.
How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
Sign in for the best experience
Save your progress
Get access to courses
Receive personalized recommendations
May we collect and use your data?
Learn more about the Third Party Services we use and our Privacy Statement.May we collect and use your data to tailor your experience?
Explore the benefits of a customized experience by managing your privacy settings for this site or visit our Privacy Statement to learn more about your options.