Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic Error "the unit name is not valid in Inventor"

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
phillip.shields
1524 Views, 4 Replies

iLogic Error "the unit name is not valid in Inventor"

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.

TRANSITION02.png

 

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

 

4 REPLIES 4
Message 2 of 5
pcrawley
in reply to: phillip.shields

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
Peter
Message 3 of 5
MegaJerk
in reply to: phillip.shields

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 

 



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
Message 4 of 5
phillip.shields
in reply to: pcrawley

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.

Message 5 of 5
phillip.shields
in reply to: MegaJerk

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.

 

1234.png

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report