run a rule when a parameter change

run a rule when a parameter change

Torben.pedersen
Collaborator Collaborator
1,517 Views
18 Replies
Message 1 of 19

run a rule when a parameter change

Torben.pedersen
Collaborator
Collaborator

hallo there

 

I what to make a rule, that updates / run automaticaly when the diameter change here is an exeampel:

 

if Dia1 change then

run rule BT

 

end if

 

I know I´m not using the right terms, thats why I need some help 🙂

 

hope this makes sense to you, or else feel free to ask questions 🙂

I hope this was helpfull.
Did I answer your question please accept this as solution.

if you liked my answer feel free to give me a Kudo 🙂
0 Likes
Accepted solutions (1)
1,518 Views
18 Replies
Replies (18)
Message 2 of 19

Thomas_Savage
Advisor
Advisor

Hello,

 

Could you attach your file so i could have a look?

 

You could create a rule so when DIA1 is a certain size, or more, less than a certain size, it will run a rule.

 

If you attach your file i will show you what i mean.

 

Thomas. 



Thomas Savage

Design Engineer


Message 3 of 19

Torben.pedersen
Collaborator
Collaborator

I'm afraid I can´t attach the file or I'm not allowed. ( furthermore the parameter name´s are in german )

 

I know I can set i up like you explained, but that´s not what I need.
I need the rule to do as previously explained, is that not possible or  is the only way to do as you described? 🙂

I hope this was helpfull.
Did I answer your question please accept this as solution.

if you liked my answer feel free to give me a Kudo 🙂
0 Likes
Message 4 of 19

Thomas_Savage
Advisor
Advisor

Hello,

 

Yes you could do it. 

 

But without looking at your part it is harder to create a rule.

 

What i was saying in my previous post is. You need to specify what size the the dia changes to, to run rule.

 

So you could do something like this:

 

If Dia1  = 20 Then

 

iLogicVb.RunRule("RuleName")

 

End if

 

If you don't specify a size of diameter, how will it know when to run the rule.

 

And place the rule you want to run in ("RuleName")

 

You could put any size you want, i just put 20 for an example.

 

you could also do < > before the = so it is more or less the size.

 

Hope this is what you mean?

 

Thomas.



Thomas Savage

Design Engineer


Message 5 of 19

Torben.pedersen
Collaborator
Collaborator

so could I do somthing like this:

 

If Dia1  < (less then) 9999999999999999999 Then

 

iLogicVb.RunRule("RuleName")

 

End if

 

and then every time I change Dia1 and it´s less then 9999999999999999999 mm the rule runs?

I hope this was helpfull.
Did I answer your question please accept this as solution.

if you liked my answer feel free to give me a Kudo 🙂
0 Likes
Message 6 of 19

salariua
Mentor
Mentor

is this what you are after:

 

170824-01.gif

 

Check my attached part made in 2017.

 

I have created a "Check" parameter and when diameter is different than check value it will run the second rule and update the check.

 

First rule

 

 

If Parameter("Check") <> Parameter("Dia") Then
	iLogicVb.RunRule("DiaChanged")
End If

 

Second Rule

 

Check = Dia
InventorVb.DocumentUpdate()

MessageBox.Show("dia changed to: " & Dia , "i")

 

 

 

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 7 of 19

Thomas_Savage
Advisor
Advisor

Hello,

 

Like this:

 

If Dia1  <  = 9999999999999999999 Then

 

iLogicVb.RunRule("RuleName")

 

End if

 

Try it and let me know how it goes.

 

Thomas.



Thomas Savage

Design Engineer


Message 8 of 19

Thomas_Savage
Advisor
Advisor
Accepted solution

Hello,

 

I forgot to put the update as well.

 

If Dia1  <  = 9999999999999999999 Then

 

iLogicVb.RunRule("RuleName")

 

End if

 

InventorVb.DocumentUpdate()

 

Try it and let me know how it goes.

 

Thomas.



Thomas Savage

Design Engineer


Message 9 of 19

Torben.pedersen
Collaborator
Collaborator

Hallo thomas

 

thanks for your help and feedback. It worked

I hope this was helpfull.
Did I answer your question please accept this as solution.

if you liked my answer feel free to give me a Kudo 🙂
0 Likes
Message 10 of 19

salariua
Mentor
Mentor

@Thomas_Savage wrote:

 

If Dia1  <  = 9999999999999999999 Then

 

 


Wouldn't this be TRUE all the time not just on diameter change?? so the rule will run every single time rather than just when diameter changes?

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
0 Likes
Message 11 of 19

Thomas_Savage
Advisor
Advisor

Hello,

 

You're welcome.

 

Glad it worked.

 

Thomas



Thomas Savage

Design Engineer


0 Likes
Message 12 of 19

Thomas_Savage
Advisor
Advisor

Hello,

 

I am sure it would only run the rule when the diameter is changed?

 

So if you don't change the diameter, it will not run the rule.

 

I usually use the more, and less than and it only runs the rule when i change the size.

 

I am not on a computer with Inventor at the moment. So cant test it.

 

But i am sure it will not update until the diameter is changed.

 

Thomas



Thomas Savage

Design Engineer


Message 13 of 19

Torben.pedersen
Collaborator
Collaborator

the rule will only look at the Dia1 when it change I guess, and that is what I need

I hope this was helpfull.
Did I answer your question please accept this as solution.

if you liked my answer feel free to give me a Kudo 🙂
Message 14 of 19

salariua
Mentor
Mentor

well... if you are happy... so are we.

 

you need to limit the number of digits on 999999 check or you will get an error

 

Inventor_170824_09-52-08.png

 

keep in mind there is a limitation with this and that second rule will run sometimes run even if diameter has not changed...

 

170824-02.gif

 

 

 

 

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 15 of 19

Torben.pedersen
Collaborator
Collaborator

yeah I found out with the digits, I set it to 20 because it will never be more than around 10 and not under 1,5
so I could also change the rule to only be active between those numbers

I hope this was helpfull.
Did I answer your question please accept this as solution.

if you liked my answer feel free to give me a Kudo 🙂
0 Likes
Message 16 of 19

Torben.pedersen
Collaborator
Collaborator

the rule looks like this now: 

 

SyntaxEditor Code Snippet

If BB <= 20 Or BB >= 1 Then
iLogicVb.RunRule("BT")
End If

InventorVb.DocumentUpdate()
I hope this was helpfull.
Did I answer your question please accept this as solution.

if you liked my answer feel free to give me a Kudo 🙂
Message 17 of 19

Thomas_Savage
Advisor
Advisor

Yes i usually use less then a size, and more than a size.

 

Your rule looks good.

 

Thomas.



Thomas Savage

Design Engineer


Message 18 of 19

Torben.pedersen
Collaborator
Collaborator

cool thanks for the help, I really only need a push in the right direction, and the it comes to me 🙂

I hope this was helpfull.
Did I answer your question please accept this as solution.

if you liked my answer feel free to give me a Kudo 🙂
Message 19 of 19

Thomas_Savage
Advisor
Advisor

You're welcome.



Thomas Savage

Design Engineer


0 Likes