iLogic Tutorial – Derived Block Library – 12

iLogic Tutorial –  12 –  Continuing to Write the iLogic Rules

To begin writing the rules, select the Add Rule icon tool from the iLogic Panel of the Manage Tab. Name the rule Profiles as shown below…

iLogic Tutorial Derived Block Library Page Twelve Image 01 - iLogic Rule Name Dialog Box

The iLogic rule for this panel is very straight forward. The iLogic Profile parameter we just created was a string parameter with six values that correspond to the six available sweep features in the model. So we will need six code blocks, one for each of the values, that unsuppress their corresponding sweep and suppress all others.

 

The first block will be for the 54115 profile, and we will simply make the declaration that If the parameter Profile is set to the 54115 value, Then do the following: unsuppress the 54115 Cut sweep by making it Active, and leave all of the others suppressed by stating that the Active state for them are False.

If Profile = “54115” Then
Feature.IsActive(“54115 Cut”) = True
Feature.IsActive(“54116 Cut”) = False
Feature.IsActive(“54117 Cut”) = False
Feature.IsActive(“54118 Cut”) = False
Feature.IsActive(“54119 Cut”) = False
Feature.IsActive(“54121 Cut”) = False

The next block of code deals with the next Profile, and differs from the first in that it starts with ElseIf. What this means is that  if the code was not set to the previous value, check to see If the Profile parameter is set to 54116. If it is, Then execute the following code.

ElseIf Profile = “54116” Then
Feature.IsActive(“54115 Cut”) = False
Feature.IsActive(“54116 Cut”) = True
Feature.IsActive(“54117 Cut”) = False
Feature.IsActive(“54118 Cut”) = False
Feature.IsActive(“54119 Cut”) = False
Feature.IsActive(“54121 Cut”) = False

If the parameter was not set to the 54116 stated in the code above, the program keeps looking until it finds an ElseIf variable that matches the parameter setting, so we create blocks of code for the rest of the variables in the same manor as the block of code above…

ElseIf Profile = “54117” Then
Feature.IsActive(“54115 Cut”) = False
Feature.IsActive(“54116 Cut”) = False
Feature.IsActive(“54117 Cut”) = True
Feature.IsActive(“54118 Cut”) = False
Feature.IsActive(“54119 Cut”) = False
Feature.IsActive(“54121 Cut”) = False
ElseIf Profile = “54118” Then
Feature.IsActive(“54115 Cut”) = False
Feature.IsActive(“54116 Cut”) = False
Feature.IsActive(“54117 Cut”) = False
Feature.IsActive(“54118 Cut”) = True
Feature.IsActive(“54119 Cut”) = False
Feature.IsActive(“54121 Cut”) = False
ElseIf Profile = “54119” Then
Feature.IsActive(“54115 Cut”) = False
Feature.IsActive(“54116 Cut”) = False
Feature.IsActive(“54117 Cut”) = False
Feature.IsActive(“54118 Cut”) = False
Feature.IsActive(“54119 Cut”) = True
Feature.IsActive(“54121 Cut”) = False
ElseIf Profile = “54121” Then
Feature.IsActive(“54115 Cut”) = False
Feature.IsActive(“54116 Cut”) = False
Feature.IsActive(“54117 Cut”) = False
Feature.IsActive(“54118 Cut”) = False
Feature.IsActive(“54119 Cut”) = False
Feature.IsActive(“54121 Cut”) = True
EndIf

As you can see, all of the blocks are identical except for the variable they are looking for, and the true statement that activates the feature if said variable is found. The EndIf declaration stops the program from going further, but in reality, it will stop before that because all of the variables are present, and it will stop and execute one before then. When done click the OK button. The program will immediately execute whatever variable the iLogic parameter was set to. The code can be found here: Profiles_Ilogic_Code.txt

– iLogic Tutorial for the Derived Block Library –

Intro12345678910111213

 

Derived Block Library

Subscribe to Blog via Email