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: 

Custom event trigger

10 REPLIES 10
Reply
Message 1 of 11
mk92
1021 Views, 10 Replies

Custom event trigger

Hello,

 

there is an event trigger in Inventor wich reacts when a model parameter is changed. But is doesn't react when a user parameter is changed.

Is there a way to change this? Or an other way to do that?

 

I cannot use something like this:

' Check if Length parameter has changed
If Not Length = Length_Memory Then
      MessageBox.Show("Änderung erfolgt!")
End If

' Set memory parameter again
Length_Memory = Length

 

Because the parameters i want to check aren't always there (they are created an deleted in another rule). So i need to react to the user parameter changes in generel oder for parameters regardless of whether they are there or not.

 

Any ideas?

10 REPLIES 10
Message 2 of 11
MegaJerk
in reply to: mk92

If you’re making a change to a part that doesn’t actually change the part, couldn’t the data be moved to something like iProperties? In most cases, changing a user parameter that dictates the model will inevitably change the modeling parameters as well (even if it’s really far down the line), which is why the Event Trigger targets that set of parameter tables.

With that in mind, are your User Parameter changes being used to make modeling decisions, or are they just acting as properties that determine something in the bigger picture or expose some data that you want access to somewhere else?



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

GitHub
Message 3 of 11
mk92
in reply to: MegaJerk

Okay i have to explain a bit more. 

 

The user parameters depends on another parameter. 

 

Like:

 

Number_of_xyz = 1, then there will be one new user parameter to set the position of xyz like Position_xyz_1. This causes that a surface body at Position_xyz_1 will be invisible and another surface body will become visible. 

 

But if you set the Number_of_xyz = 0 then the parameter is deleted. And if you once set the position to lets say 210mm (...from start plan) there must be the posibility to change it. After that the Model has to be updated automaticly. And because this parameter doesn't change any model parameters the normal trigger doesn't work for me.

 

In addition there can be Number_of_xyz up to 4.

 

Any Idea?

Message 4 of 11
MegaJerk
in reply to: mk92

If you are configuring the part based off parameters / code elsewhere, would it not be possible to simply run the rule straight from the code that is configuring the part? In this way no trigger would be needed.

If that is not possible could you attach an example assembly / part along with the inventor year that was used to create it?



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

GitHub
Message 5 of 11
mk92
in reply to: MegaJerk

No its not possible to do that directly in the code wich configures the part. The main problem ist that when the parameter is there and you have given a value for it like 220mm and you noticed that 220 is wrong an change it to 260mm (or anything else) the rule did not start again.

 

When i write something like

 

..

do that visible

do that invisible

...

do the rule again

 

it would be a endless loop.

 

So i have to check if there is a change in the parameter and then do a small part of the rule again (the visible and invisible part only) to update the model.

 

I can do a example part but it will take a bit 😉 but possibly we find a solution.

Message 6 of 11
MegaJerk
in reply to: mk92

Yes. please do create a part for us to work with. I'm certain that the problem will be solved once there is more to look at! 



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

GitHub
Message 7 of 11
mk92
in reply to: MegaJerk

So here it is. Maybe it will help you to understand me.

 

The part has two rules. The first checks the Parameter "Anzahl" (German word for number) and creates the Parameter(s) Position_x or delets them.

 

The second rule should check the parmeters for the positions and show the messagebox in this example. Later on it should start another rule.

 

But the check for the parameter change doesn't work!

 

The Part is created in Inventor 2014.

Message 8 of 11
mk92
in reply to: mk92

Anyone any idea? Or any questions to my part?

Message 9 of 11
MegaJerk
in reply to: mk92

Sorry for the delay on the reply to this. I have been rather busy at work, but do plan on looking at this problem when I get in! 

I'll post here after the ol' 9 to 5. 



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

GitHub
Message 10 of 11
mk92
in reply to: MegaJerk

Great thank you very much! 😃

Message 11 of 11
VdVeek
in reply to: mk92

While searching the forum i found this older tread and thought of a solution to your question.

When you want to run a rule when you change a User Parameter add this to your rule at the beginning.

trigger = ParameterName

where ParameterName is the name of your parameter. And you don't need to add the rule to an event trigger for this.

To rune a rule on multiple paramters use this option

trigger = ParameterName1 & ParameterName2
'Like:
trigger = d2 & d3

Hope this help others.

Rob.

Autodesk Inventor 2015 Certified Professional & Autodesk Inventor 2012 Certified Professional.

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

Post to forums  

Autodesk Design & Make Report