Run External Rules on User Parameter Change?

Run External Rules on User Parameter Change?

brendon.serrano
Enthusiast Enthusiast
2,000 Views
5 Replies
Message 1 of 6

Run External Rules on User Parameter Change?

brendon.serrano
Enthusiast
Enthusiast

I am running Inventor 2019.4.5

I am trying to use a global form to update the iProperties. I have a spreadsheet that drives the parameter options. these parameter options are based on a different parameter selection.

 

Eg: if you choose Parameter(Major) to be 1, you will get the Parameter(Minor) options to be [a,b,c]. Where if you choose parameter(Major) to be 2, you will get the Parameter(Minor) options to be [d,e,f].

 

I had this working using internal rules by having the the trigger for the rule that set the minor list to be triggered by the major parameter change. This worked well and the form live updated as I cycled through the Majors. Now using external Rules and Global forms the rule wont trigger. I understand that you can't trigger external rules the same way and put the rule to be triggered on "Any Model Parameter Change," but this doesn't run the rule on user parameters. Is there a work around to this or something I am missing?

Accepted solutions (1)
2,001 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

One trick I use for several situations, is to create a simple local rule that as one or more useless'dummy variables' at the top of it, that are set to the Parameter you want to trigger the rule.  Then a RunExternalRule line right after those dummy variables.  Then it's pretty much the same functionality as if the external rule was local.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

WCrihfield
Mentor
Mentor

Another trick, to get around the whole UserParameter vs ModelParameter thing, is to set the UserParameters to Export, within the Parameters dialog box (or by code), then they automatically create Custom iProperties with the same names & values.  Every time the UserParameter changes, it also changes those Custom iProperties.  So then you can use the "iProperty Change" event in the Event Triggers.  Of course this is not an ideal situation, but it's a pretty good workaround, until Autodesk expands the list of Events available within that dialog.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 6

brendon.serrano
Enthusiast
Enthusiast

Thanks for the ideas. These may work well for someone else looking into this subject. The issue I have with these solutions is that I need the rules to be able to work with older files that will not have the internal "dummy" rules. This is the reason I went over to external rules. For the same reason I cannot use the iProperty change as the trigger because that is not in the Parts or Assemblies tabs in the Event Trigger dialog. it is only in the This Document tab. I am currently looking into a solution using a macro. 

Message 5 of 6

WCrihfield
Mentor
Mentor
Accepted solution

The external rule can check to see if the target document has a local rule in it, and create it if not found, too.  I've done this several times before.

For instance, we have a lot of parts that are simply standard profiles, extruded to different lengths.  Each length being used in an assembly has its own Part file.  So I created an external rule that makes sure the Part has a standard UserParameter in it called "CUT_LENGTH", and if not found, creates it.  It then makes sure that Parameter is driving the first extrude feature.   It then checks to see if that Part file has a specifically named local rule in it, and if not found, creates it.  That local rule is laid out the way I mentioned before.

First line is:   oDV = CUT_LENGTH

Second line is:   iLogicVb.RunExternalRule("ExternalRuleName")

 

As far as I know, Macro's are fairly similar to external iLogic rules, as far as how you can trigger them.  It may be easier to work with Events in VBA, but for a solution that is always watching in the background for events, you would probably need an Add-in.

Just throwing some ideas out there.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes