& Construction
Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
& Manufacturing
Professional CAD/CAM tools built on Inventor and AutoCAD
Using logic statements in creating code block rules.
Logic statements are an essential part of creating code block rules.
Here, the height of a wall needs to be evaluated to ensure that if the wall height equals the opening height, the opening will be reset to a specified lower value.
The if do block and the comparison block are pulled from the logic blocks library and assembled to create the framework of the conditional statement, then filled in with a variable and parameter block.
The due portion of the if due block is then set to execute the setting of the opening height parameter to be reset to a specified lower value.
Additionally, the existing block that sets the opening height list is duplicated.
Added to the due statement and then modified to remove the invalid choice.
In addition to the basic if do block, and if do else if block can be used to evaluate additional conditions.
Here, a value is added to an existing parameter choice list.
Then using the plus sign next to the word if, the existing if do block is expanded to add an else if statement.
Next, parameter blocks from the existing if block are duplicated added to the new else if and do block areas and then updated to supply the desired logic.
The plus sign can be used to add as many else if statements as needed, and the parameter blocks duplicated and updated to build out the logic needed to create the rule logic as required.
In addition to the if do block, the logic code block library contains an if do else block.
Here, the if do block is replaced with the if do else block.
The else statement allows us to specify what should happen when the if statement is not true or when none of the if else statements evaluate as true.
The comparison code block contains a list of standard equality operators, including equal, not equal, less than less than or equal to greater than and greater than or equal to.
Additionally, there is a logical operator code block, which contains the and and or operators.
The and operator evaluates the statement as false if any condition is false. Conversely, The or operator evaluates the statement as true if any condition is true.
Here, the and operator is added to the if do statement.
The parameter block containing the equals comparison block is duplicated and added to the right side of the and.
And then the right click external inputs option is used to wrap the code block to better fit on screen.
Next, the first comparison operator is changed from equals to greater than. And the second is changed to less than. Finally, the due statement block is updated to evaluate the correct value when the wall height is greater than the first value. And less than the second.
In summary, if do code blocks with else and else if statements, combined with operator code blocks can be used together to create powerful logic rules, allowing you to evaluate a robust set of logic.