iLogic rules not firing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an application i'm working with that copies 'template' files from a folder into your working folder and then alters them based on parameters you feed the existing models.
I'm having to use ilogic to map a couple features like Part Number. Problem i'm running to is that the rules do not fire.
The original problem is that the basic rule worked just fine - on 'Before Save' i simply had it copy the application PN to the inventor partnumber. Worked just fine. However, users complaint was the rule kept running and they couldn't overwrite the the pn's when needed without entering each affected part and removing the trigger setting, or editing the iproperty value that got mapped. So i tried turning the ilogic into something that just did it's copy once so they wouldn't have to worry about it.
I have about 150 different template file and i did not want to go through all and add a counter parameter to them, so i tried to write something that would do the job of seeing if the counter existed, and if it didn't, add it and update the properties. Next pass, it just wouldn't run.
Well, the ilogic works - IF i'm already in the part, in inventor, and i manually run the rules. In the copy/update process it does not. The basic ilogic line of:
iProperties.Value("Project", "Part Number") = iProperties.Value("Custom", "MYPartNumber")
works fine if that's the entire script. The copy/update process runs and the pn updates fine. When i change it to:
varPartDoc = ThisDoc.Document
varPartDoc.Update
'add PNOnce parameter if it doesn't exist
Try
'Change value of parameter
Parameter("PNOnce") = "True"
Catch
'Create Parameter as it doesn't exist but set the values first
iProperties.Value("Project", "Part Number") = iProperties.Value("Custom", "MYPartNumber")
varPartDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("PNOnce", False, "BOOLEAN")
End Try
That? Simply doesn't run during the copy/update process. But it runs if i hit 'save' while i have the part number in inventor.
Any ideas as to why? Or is it manually add it to all 150ish files?