iLogic code giving an error when executed

iLogic code giving an error when executed

Anonymous
Not applicable
1,852 Views
12 Replies
Message 1 of 13

iLogic code giving an error when executed

Anonymous
Not applicable
Hi, I have been writing a few routines to augment our system here, with great success. However, I have one iLogic routine that is giving me an error whenever I run it. Selecting continue allows it run as expected. Basically, it is to remind designers to set the material type to other than “Default”. Here is the code: Materialsddd = 0' deleted parameter materialName = ThisDoc.Document.ComponentDefinition.Material.Name If materialName = "Default" Then MultiValue.List("MName") = iProperties.Materials MName = InputListBox("Select Material", MultiValue.List("MName"), Mname, Title := "Select Type", ListName := "MM List") iProperties.Material = Mname iLogicVb.UpdateWhenDone = True The Parameter MName does exist as a mulitlist parameter. End If If someone could run their eyes over it and let me know how to fix this. Or, turn off the JIT error box? Much appreciated.
0 Likes
1,853 Views
12 Replies
Replies (12)
Message 2 of 13

Anonymous
Not applicable

Your code is very confusing. Can you post it back with indentations and individual lines per code runs?

Thought initially would be to create a list of the proper materials you want normally using ilogic and using a Radio box list to select from.  I am assuming the material can be selected in iproproperties and populated into materials selection list?.

0 Likes
Message 3 of 13

MjDeck
Autodesk
Autodesk

I attached a working version of your rule in the file SelectMaterials.txt

Inventor parameter names are case sensitive.  You had "Mname" instead of "MName" in a few places.


Mike Deck
Software Developer
Autodesk, Inc.

Message 4 of 13

Anonymous
Not applicable
Thanks for the heads up. I really should have checked that first. But unfortunately, it still gives me the "unhandled exception" error. ????? Any ideas?
0 Likes
Message 5 of 13

MjDeck
Autodesk
Autodesk

Can you post the part file?

What are the details of the error message?  If it has a More Info tab, please click on that and copy and paste the text here.  It might have some useful info.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 6 of 13

MjDeck
Autodesk
Autodesk

Here's a better version of the rule.  This one will not throw an error if you to close the dialog without clicking OK.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 7 of 13

Anonymous
Not applicable

Part file attached.

 

Error message details attached.

 

Thanks

0 Likes
Message 8 of 13

Anonymous
Not applicable

Thanks, that works. But I still get the "undandled excetion" error dialog.

0 Likes
Message 9 of 13

Anonymous
Not applicable

Error screen capture of the dialog attached fyi.

 

Cheers

0 Likes
Message 10 of 13

Anonymous
Not applicable

Code attached (formatted)

 

Cheers,

0 Likes
Message 11 of 13

Anonymous
Not applicable

Here is an interesting tid bit. I changed the iLogic Form section that was running the rule “Material” from being an external rule on the server to a local rule saved within the document (part file) and all the errors disappeared….!

 

Interesting eh……Maybe a trap for young players?

 

I do believe I've fixed it. 

 

Thanks for all your help, appreciated.

0 Likes
Message 12 of 13

MjDeck
Autodesk
Autodesk

Here's a version of your part containing the modified rule.  It should work OK.

I also attached a version of the rule that will work as an external rule.  In an external rule, you can't access a parameter such as MName directly as a variable.  You have to use the Parameter function, e.g. Parameter("MName").


Mike Deck
Software Developer
Autodesk, Inc.

Message 13 of 13

Anonymous
Not applicable

Thanks Mike. Your'e a champion.......

0 Likes