Run iLogic Rule when Generating part from iPart Factory

Run iLogic Rule when Generating part from iPart Factory

Anonymous
Not applicable
401 Views
1 Reply
Message 1 of 2

Run iLogic Rule when Generating part from iPart Factory

Anonymous
Not applicable

I have an iPart Factory driving a sheet metal remnant system, and I am trying to have an emboss for laser etching the part number based on material, thickness, and size.  I currently have a rule that is triggered when "Any Model Parameter Change" to copy the Part Number from iProperties to a custom parameter that drives the emboss. So far, this works when a new instance of an iPart is opened, but will only run if an instance is opened.

 

Is there a program or trigger I should be using so that my parameter is updated and part updated when a "Generate Files" is triggered for the table? I would like to avoid opening each instance the generate a file from it. Below is the code I used for reference.

 

iLogicVb.UpdateWhenDone = True
PART_NUMBER = iProperties.Value("Project", "Part Number")

  

0 Likes
402 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Is the parameter you're working with a UserParameter? If so, the "Any Model Parameter Change" event won't work for it.  The most efficient way to trigger a rule to run when a UserParameter changes, is to use a local rule (saved within the model file) that uses that local parameter by name, even if it is just assigning its value to a dummy variable (which is what I usually do) at the top of the local rule.  Then, under that dummy variable, use the code from the iLogic Rule Editor's built-in snippets like the following:

oDV = PN
iLogicVb
.RunExternalRule("ruleFileName")

 Where PN is the name of the local parameter (within that model), and change "ruleFileName" to the name of your external iLogic rule.

Then any time the value of that parameter changes within that model file, it will trigger that rule to run.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes