Hi,
I'm getting a strange error with my iLogic code running parameters in my assembly. When I have one "if....then..." my rule runs fine. Even two statements work. But for some reason when I get to a certain number of statement I get an error: I've attached some sample code and snapshots of my error screens.
If FLANGE_STYLE_BOTTOM = "2in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="6" Parameter("RD FLANGE:1", "BC")="4.75" Parameter("RD FLANGE:1", "HOLE_SIZE")=".75" Parameter("RD FLANGE:1", "NUB_HOLE")="4" Else If FLANGE_STYLE_BOTTOM="3in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="7.5" Parameter("RD FLANGE:1", "BC")="6" Parameter("RD FLANGE:1", "HOLE_SIZE")=".75" Parameter("RD FLANGE:1", "NUB_HOLE")="4" Else If FLANGE_STYLE_BOTTOM="4in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="9" Parameter("RD FLANGE:1", "BC")="7.5" Parameter("RD FLANGE:1", "HOLE_SIZE")=".75" Parameter("RD FLANGE:1", "NUB_HOLE")="8" Else If FLANGE_STYLE_BOTTOM="5in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="10" Parameter("RD FLANGE:1", "BC")="8.5" Parameter("RD FLANGE:1", "HOLE_SIZE")=".875" Parameter("RD FLANGE:1", "NUB_HOLE")="8" Else If FLANGE_STYLE_BOTTOM="6in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="11" Parameter("RD FLANGE:1", "BC")="9.5" Parameter("RD FLANGE:1", "HOLE_SIZE")=".875" Parameter("RD FLANGE:1", "NUB_HOLE")="8" Else If FLANGE_STYLE_BOTTOM="8in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="13.5" Parameter("RD FLANGE:1", "BC")="11.75" Parameter("RD FLANGE:1", "HOLE_SIZE")=".875" Parameter("RD FLANGE:1", "NUB_HOLE")="8" Else If FLANGE_STYLE_BOTTOM="10in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="16" Parameter("RD FLANGE:1", "BC")="14.25" Parameter("RD FLANGE:1", "HOLE_SIZE")="1" Parameter("RD FLANGE:1", "NUB_HOLE")="12" Else If FLANGE_STYLE_BOTTOM="12in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="19" Parameter("RD FLANGE:1", "BC")="17" Parameter("RD FLANGE:1", "HOLE_SIZE")="1" Parameter("RD FLANGE:1", "NUB_HOLE")="12" Else If FLANGE_STYLE_BOTTOM="14in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="21" Parameter("RD FLANGE:1", "BC")="18.75" Parameter("RD FLANGE:1", "HOLE_SIZE")="1.125" Parameter("RD FLANGE:1", "NUB_HOLE")="12" Else If FLANGE_STYLE_BOTTOM="16in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="23.5" Parameter("RD FLANGE:1", "BC")="21.25" Parameter("RD FLANGE:1", "HOLE_SIZE")="1.125" Parameter("RD FLANGE:1", "NUB_HOLE")="16" Else If FLANGE_STYLE_BOTTOM="18in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="25" Parameter("RD FLANGE:1", "BC")="22.75" Parameter("RD FLANGE:1", "HOLE_SIZE")="1.25" Parameter("RD FLANGE:1", "NUB_HOLE")="16" Else If FLANGE_STYLE_BOTTOM="20in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="27.5" Parameter("RD FLANGE:1", "BC")="25" Parameter("RD FLANGE:1", "HOLE_SIZE")="1.25" Parameter("RD FLANGE:1", "NUB_HOLE")="20" Else If FLANGE_STYLE_BOTTOM="24in 150 BFV" Then Parameter("RD FLANGE:1", "OD")="32" Parameter("RD FLANGE:1", "BC")="29.5" Parameter("RD FLANGE:1", "HOLE_SIZE")="1.375" Parameter("RD FLANGE:1", "NUB_HOLE")="20" Else If FLANGE_STYLE_BOTTOM="8in SHICK BFV" Then Parameter("RD FLANGE:1", "OD")="11" Parameter("RD FLANGE:1", "BC")="9.75" Parameter("RD FLANGE:1", "HOLE_SIZE")=".5" Parameter("RD FLANGE:1", "NUB_HOLE")="8" Else If FLANGE_STYLE_BOTTOM="12in SHICK BFV" Then Parameter("RD FLANGE:1", "OD")="15" Parameter("RD FLANGE:1", "BC")="13.75" Parameter("RD FLANGE:1", "HOLE_SIZE")=".5" Parameter("RD FLANGE:1", "NUB_HOLE")="12 Else If FLANGE_STYLE_BOTTOM = "16in SHICK BFV" Then Parameter("RD FLANGE", "OD") = "19" Else If FLANGE_STYLE_BOTTOM="20in SHICK BFV" Then Parameter("RD FLANGE:1", "OD")="23" Parameter("RD FLANGE:1", "BC")="21.75" Parameter("RD FLANGE:1", "HOLE_SIZE")=".5" Parameter("RD FLANGE:1", "NUB_HOLE")="12" Else If FLANGE_STYLE_BOTTOM="2000 AIRLOCK" Then Parameter("RD FLANGE:1", "OD")="17" Parameter("RD FLANGE:1", "BC")="15.5" Parameter("RD FLANGE:1", "HOLE_SIZE")=".625" Parameter("RD FLANGE:1", "NUB_HOLE")="12" End If
Solved! Go to Solution.
Solved by MegaJerk. Go to Solution.
This looks like a good opportunity to try out the "Select Case" statement.
There may be a limit to the number of Else If's. I haven't yet hit the limit of Select Case.
Select case FLANGE_STYLE_BOTTOM
Case "2in 150 BFV" Parameter("RD FLANGE:1", "OD")="6" Parameter("RD FLANGE:1", "BC")="4.75" Parameter("RD FLANGE:1", "HOLE_SIZE")=".75" Parameter("RD FLANGE:1", "NUB_HOLE")="4" Case "3in 150 BFV" Parameter("RD FLANGE:1", "OD")="7.5" Parameter("RD FLANGE:1", "BC")="6" Parameter("RD FLANGE:1", "HOLE_SIZE")=".75" Parameter("RD FLANGE:1", "NUB_HOLE")="4" Case "4in 150 BFV"
.
.
.
End Select
I suspect that it has something to do with this bit :
Else If FLANGE_STYLE_BOTTOM = "16in SHICK BFV" Then Parameter("RD FLANGE", "OD") = "19" Else If FLANGE_STYLE_BOTTOM="20in SHICK BFV" Then
Looks like you dropped off the occurrence name ID. If so, it should probably be :
Else If FLANGE_STYLE_BOTTOM = "16in SHICK BFV" Then Parameter("RD FLANGE:1", "OD")= "19" Else If FLANGE_STYLE_BOTTOM = "20in SHICK BFV" Then
Also, assuming that your parameter 'OD' is not a text parameter, you could leave off the quotes, making your code look something like :
Else If FLANGE_STYLE_BOTTOM = "16in SHICK BFV" Then Parameter("RD FLANGE:1", "OD")= 19 Else If FLANGE_STYLE_BOTTOM = "20in SHICK BFV" Then
Thank you for the quick response but I think I found my problem. If you look back the original code I posted in line 91 of my code right before my "16in SHICK BFV" line. the occurence "NUB_HOLE" = "12. I FORGOT MY OTHER QUOTATION MARK. I will be using that select case though. I feel like that may come in handy.
Thank you for your response. In the process of taking off all of my quotation marks I found the problem. I was missing a second quote after my 12. From now on I will just leave them off of numbers.
Can't find what you're looking for? Ask the community or share your knowledge.