Strange iLogic error

Strange iLogic error

mrattray
Advisor Advisor
2,168 Views
3 Replies
Message 1 of 4

Strange iLogic error

mrattray
Advisor
Advisor

I keep getting a rule compile error "all other subs and functions must appear after sub main" (see attached) for one of the rules in an assembly file. The thing is, Sub Main is the only sub or function in the rule and the only thing outside of it is my option explicit line. I checked, double checked, and then triple checked that I didn't have some stray sub statement somewhere and that Sub Main didn't have a typo.  I even tried deleting the option explicit line and making Sub Main the very first line in the rule.  I would just blow away the sub / end sub since it's the only one in the rule but I need to pass variables to it and I'm using the Sub Main(ByVal variable As Single) statement.

The wierd part is that it worked just fine yesterday, and I can't think of anything I've changed since then.

 

Any thoughts?

Mike (not Matt) Rattray

0 Likes
Accepted solutions (1)
2,169 Views
3 Replies
Replies (3)
Message 2 of 4

mrattray
Advisor
Advisor

Maybe it'll help if I post the code. It's attached.

Mike (not Matt) Rattray

0 Likes
Message 3 of 4

mrattray
Advisor
Advisor

I managed to get a work around by commenting out the sub/end sub lines and passing the variables using an argument map and accessing the variables directly using the rulearguments function.  I'm still curious why Inventor doesn't like me using the ByVal argument, though.

Mike (not Matt) Rattray

0 Likes
Message 4 of 4

MjDeck
Autodesk
Autodesk
Accepted solution

As you found, you have to use the RuleArguments function.  There's no way to pass arguments directly to Sub Main().  We could improve the error message.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes