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: 

Refresh iLogic Rule

17 REPLIES 17
SOLVED
Reply
Message 1 of 18
Breeze104
1456 Views, 17 Replies

Refresh iLogic Rule

Is there some syntax that would refresh a previouse rule before the next one starts?  I have a file where the constraint is not turning on when it is supposed to, but all I have to do is refresh the rule and it works.

 

 

See video:

http://screencast.com/t/Nnyru3ePIk

 

17 REPLIES 17
Message 2 of 18
swordmaster
in reply to: Breeze104

iLogicVb.RunRule

("add rule name here!")

Inventor 2010 Certified Professional
Message 3 of 18
Breeze104
in reply to: Breeze104

Sorry it took so long to get back...there have been issues..LOL

 

I tried what you suggested, But...there are issues....LOL

 

Rule Compile Errors in AxleBrackets, in Hoppers-01.iam

Error on Line 1 : Overload resolution failed because no accessible 'RunRule' accepts this number of arguments.

Error on Line 2 : Syntax error.

 

This is how I coded it

 

iLogicVb.RunRule

("Hopper_Type")

 

I also tried without the  () as well and I get the same error.

 

 

I put the...iLogicVb.RunRule... code in as a seperate rule at the end and wrote it like this...

 

iLogicVb.RunRule ("Hopper_Type")

 

and the error quit but it acts like it isn't running the rule...or is just doesn't do what I need it to do.

Message 4 of 18
Breeze104
in reply to: Breeze104

 

Well I manually ran the rule and it worked like I wanted but why doesn't seem to run when I am switching between bodies via the form?

Message 5 of 18
Breeze104
in reply to: Breeze104

Well I am running into this same issue again with another file.  This time I also tried what you suggested but it still didn't work, so I tried adding an extra rule specificly to rerun the rule in qhestion but it still didn't work.  Any suggestions?

Message 6 of 18
mrattray
in reply to: Breeze104

Can you post the code from the rule that "needs to be refreshed". I think I know what's going on but want to confirm it first.

BTW, sorry I never got around to going through those files you sent me. There was a lot there and every time I started pulling it apart and analyzing it something would come along.

Mike (not Matt) Rattray

Message 7 of 18
Breeze104
in reply to: Breeze104

Component.IsActive("72-3:1") = False
Component.IsActive("PTH 72-2:4") = False
Component.IsActive("PTH 72-2:3") = False
Component.IsActive("PTH 72-2:2") = False
Component.IsActive("PTH 72-2:1") = False
InventorVb.DocumentUpdate()
Message 8 of 18
Breeze104
in reply to: Breeze104

I am adding a link to a video that shows the rest of the rules and the code for each.

 

 

http://screencast.com/t/637aSARN3cWe

Message 9 of 18
mrattray
in reply to: Breeze104

If that's all there is in the rule, it's never going to run without being manually triggered.  Rules are only triggered automatically when a parameter it references is changed. You need some sort of a trigger in the rule.

If you're using an iLogic form, then I would simply insert the rule into the form. This will create a button you can click.

Mike (not Matt) Rattray

Message 10 of 18
Breeze104
in reply to: mrattray

If I tell the rule before it to run it would that work?  If so then what happens when I suppress the rule?  Is there a way to make an argument in the rule ahead of it to check to see if the rule is suppressed or active first and then react accordingly?

Message 11 of 18
mrattray
in reply to: Breeze104

Yes, if you put the line...

 

iLogicVB.RunRule("The name of the rule you want ran")

... into another rule then it will run everytime the rule that contains the line is ran. It will run the rule regardless of wether it is suppressed or not. Suppressing a rule is different from suppressing a part Suppressing a rule only prevents it from running automatically, it doesn't unload the rule from memory.

Mike (not Matt) Rattray

Message 12 of 18
Breeze104
in reply to: mrattray

so if I tell it to run it in the rule before it and the suppress it when I don't need it any more, it the just basicly becomes dead code.

Message 13 of 18
mrattray
in reply to: Breeze104

Suppressing that code doesn't change anything because it already wont run automatically.

Mike (not Matt) Rattray

Message 14 of 18
Breeze104
in reply to: mrattray

well I added the "run rule" code at the end of the rule above the "ScreenOnly" rule and it ran the rule eventhoug the rule was suppressed.

Message 15 of 18
mrattray
in reply to: mrattray


@mrattray wrote:
It will run the rule regardless of wether it is suppressed or not.

 

 

Mike (not Matt) Rattray

Message 16 of 18
Breeze104
in reply to: Breeze104

I figured it out.  I had to use a the Event Trigger "Componet Suppression Change".  That makes it work like it is supposed to.

 

Thanks for your help.

Message 17 of 18
swordmaster
in reply to: Breeze104

As touched upon by others, a rule will not just run you need to have a "trigger" like a parameter change or an event to "fire" a rule

You also mention  suppressing  rules, not sure exactly how you would do that much lessmake sure  the rule was unsuppressed when required. I would have the rule unsuppressed all the time and surround the code within the rule with a "if" statement. That way the rule will only run if the if statement is True

Inventor 2010 Certified Professional
Message 18 of 18
Breeze104
in reply to: swordmaster

I only need to run the rule when I am getting into the drawings associated with the wire mesh, so manually turning the rule on/off is not a problem. 

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

Post to forums  

Autodesk Design & Make Report