& Construction
Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
& Manufacturing
Professional CAD/CAM tools built on Inventor and AutoCAD
The math code blocks contain mathematical blocks to perform a variety of operations.
These include a block to create a number constant, a block containing operations of arithmetic, a block containing square root, along with other standard common functions, a trigonometry block, a rounding block, A remainder of block and a constrained block to clamp a number to arrange between a minimum and a maximum value.
When working with mathematical code blocks, it's important to understand the relationship between block grouping and the order of operations.
Here, we might expect the result to be thirty six, but instead it calculates at forty.
This is because each block acts as a grouped parenthetical calculation.
Here, the same blocks are arranged with this grouping in mind to achieve the expected result of thirty six.
Once we understand that each block represents a grouping that correlates to the standard mathematical order of operations, We can achieve the results we expect.
Next, we'll take a look at setting up a rule to calculate the area of a wall.
First, we'll add an Inventor parameter to the model to hold the calculated square footage. This will be used in our product definition form to display a read only value.
In the parameters tab of the product definition, we select area to adopt it into the form.
This product definition has been set up to display the length and height in form messages as inches.
The message blocks have been collapsed, but can be expanded to view the contents.
Likewise, they can be collapsed again as needed.
Adding a block to make area read only sets the block up for the next step of adding blocks to calculate it.
To create the calculation, the area block is added to the canvas.
Then the length block is added, then copied and pasted using control c and control v on the keyboard.
Changing the block to height, we're now ready to add the math operations block and set it to multiply.
Adding the length and height blocks to the multiply block creates the area calculation.
Using the right click external inputs option, wraps the block to fit in the canvas better.
And then a click of the form update button shows the calculated area.
Next, we'll determine the diagonal measurement of the wall from corner to corner by transforming the pythagorean theorem to solve for length c.
An existing variable called diagonal is used, and then the square root block is selected and snap to it.
Next, the general operations block is added twice, and one instance is left to do addition.
While the second is set to raise the value by a power of two.
Adding the length parameter block calculates the square value and then the block is copied and the new block is changed to use the height.
Both blocks are added to the addition block to sum the results of both square parameter values.
A right click and a selection of external inputs fits the block for easier reading.
Adding a print block to pop up the value of diagonal allows the calculated corner to corner result to be displayed when the form is updated.
Getting the angles of the diagonal corners can be calculated using the inverse tangent trigonometric block.
Here we start by duplicating an existing connected block set.
Adding the trigonometry math block, and setting it to use the Aitan function sets us up to quickly reuse existing code blocks from further up in the canvas.
Changing the variable from diagonal to one previously created called angle a completes this block rule.
Using duplicate connected to copy the entire block allows us to create a rule to solve for the remaining angle with ease and efficiency.
Updating the form shows us the results.
In summary, it's important to know that math blocks evaluate as parenthetical groups following standard order of operations.
There are numerous math blocks to explore listed in the match block library, combining to allow for a rich set of mathematical calculations.