iLogic - CASE Statement Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
As a rookie in Inventor VBA & iLogic, can I ask for a quick steer on the right approach to solve what I think is a fairly simple problem.
I need to set a dimension in an iPart to be conditional on the "Length" parameter (this is the actual parameter name).
I have some other parameters, one of which is used as the dimension in question, it's called "Dist_1".
Dist_1 will be either of two values:
Condition 1: 0
Condition 2: The result of another calculated formula within the iPart parameters
The iPart has 20 or so different lengths programmed into it. For every length which is a multiple of 100mm, I need to set Dist_1 to condition 2. For all others, condition 1.
A bit of net trawling suggest using the CASE function. I have created an iLogic rule containing the following code:
Select Case Length
Case "100"
Dist_1 =Dist_2
Case "200"
Dist_1 =Dist_2
Case "300"
Dist_1 =Dist_2
Case "400"
Dist_1 =Dist_2
Case "500"
Dist_1 =Dist_2
Case "600"
Dist_1 =Dist_2
Case "700"
Dist_1 =Dist_2
Case "800"
Dist_1 =Dist_2
Case "900"
Dist_1 =Dist_2
Case "1000"
Dist_1 =Dist_2
Case "1100"
Dist_1 =Dist_2
Case "1200"
Dist_1 =Dist_2
Case "1300"
Dist_1 =Dist_2
Case "1400"
Dist_1 =Dist_2
Case "1500"
Dist_1 =Dist_2
Case Else
Dist_1 =0
End Select
Clicking Save & Run does not generate any errors but assuming the above is correct, I'm not sure what to do next.
Some questions:
- Is the syntax for the length values correct (are the " " needed & do I need to specify the units used in the parameter setting - i.e. mm)?
- How do I link the dimension in the sketch to the output of the iLogic rule?
Thanks 🙂