- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Everyone
I'm trying to get a Select Case statement to run without producing unexpected results. I already have it to run with multiple IF THEN statements but thought I'd try to use a SELECT CASE statement.
Now as I see it the results are short circuiting so if it sees one side of the case as true it ignores the rest.
I have tried replacing '&' with AND and i end up with an error "Operator 'And' is not defined for types 'Autodesk.iLogic.Interfaces.DoubleForEquals' and 'Boolean'."
I also tried replacing the '&' for a comma to no avail.
CHUTE_TWIST_ANGLE & MITREANGLE1 & MITREANGLE2 are numeric degree parameters in the sketch.
Thought this would be an easy thing to achieve.
Here is the code.
Select CHUTE_TWIST_ANGLE Case Is <= MITREANGLE1 Parameter("LCP_CHAMFER_A") = 10 Parameter("LCP_CHAMFER_B") = 10 Parameter("LCP_CLEAR_C") = 50 Parameter("LCP_CLEAR_E") = 50 Case Is > MITREANGLE1 & CHUTE_TWIST_ANGLE <= (90 - MITREANGLE2) Parameter("LCP_CHAMFER_A") = 10 Parameter("LCP_CHAMFER_B") = 10 Parameter("LCP_CLEAR_C") = Parameter("LCP_CLEAR_C") + 1000 Parameter("LCP_CLEAR_C") = Parameter("LCP_CLEAR_C") - Parameter("LCP_CLEAR_D") + 50 Parameter("LCP_CLEAR_E") = 50 Case Is > (90 - MITREANGLE2)& CHUTE_TWIST_ANGLE <=90 Parameter("LCP_CHAMFER_A") = 10 Parameter("LCP_CHAMFER_B") = 10 Parameter("LCP_CLEAR_C") = Parameter("LCP_CLEAR_C") + 1000 Parameter("LCP_CLEAR_C") = Parameter("LCP_CLEAR_C") - Parameter("LCP_CLEAR_D") + 50 Parameter("LCP_CLEAR_E") = Parameter("LCP_CLEAR_E") + 1000 Parameter("LCP_CLEAR_E") = Parameter("LCP_CLEAR_E") - Parameter("LCP_CLEAR_F") + 50 Case Is >90 MessageBox.Show("The maximum value for 'CHUTE TWIST ANGLE' is 90: " & vbCr & "The value will be automatically corrected.", "Maximum Value Rule", MessageBoxButtons.OK, MessageBoxIcon.Error) Parameter("CHUTE_TWIST_ANGLE") = 90 End Select
It will only ever run Case 1 & 2
Solved! Go to Solution.