Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
There are KH_nAIV number of holes equally spaced along the length L, thus the distance KH_spIV between the holes is given by KH_spIV = L/(KH_nAIV-1).
The condition KH_spIV ≤ 530 is given
the number KH_nAIV is to be as low as possible while still meeting the prior condition.
My code is as follows and it doesen't work:
Parameter("LMV - SK5-KH:1", "KH_TAI") = 268
If TerskelType = "Kvilldalterskel" Then
Parameter("LMV - SK5-KH:1", "KH_BAI") = 250
Else If TerskelType = "014-terskel" Then
Parameter("LMV - SK5-KH:1", "KH_BAI") = TerskHøyde + 235
End If
SharedVariable("KH_BAI") = Parameter("LMV - SK5-KH:1", "KH_BAI")
SharedVariable("KH_TAI") = Parameter("LMV - SK5-KH:1", "KH_TAI")
SharedVariable("KH_spIV") = Parameter("LMV - SK5-KH:1", "KH_spIV")
SharedVariable("KH_nAIV") = Parameter("LMV - SK5-KH:1", "KH_nAIV")
Dim KH_BAI As Double = SharedVariable("KH_BAI")
Dim KH_TAI As Double = SharedVariable("KH_TAI")
Dim KH_spIV As Double = SharedVariable("KH_spIV")
Dim KH_nAIV As Integer = SharedVariable("KH_nAIV")
If KH_spIV < 530 and KH_nAIV >= 3 Then
While KH_spIV < 530
KH_nAIV = KH_nAIV - 1
End While
Else If KH_spIV > 530
While KH_spIV > 530
KH_nAIV = KH_nAIV + 1
End While
End If
InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True
The goal is to have the rule adjust KH_nAIV to meet the condition for KH_spIV in the case of both increasing and decreasing the length L regardless of the initial value of KH_nAIV.
Is the an "as little as possible" operator I don't know about I can use to set a condition for KH_nAIV?
Solved! Go to Solution.