Finally, we updated to 2013 Inventor Professional (64 bit).
Now I have some problems when I run the rule which I created in 2009 (32 bit).
First one is:
I created a rule which is suppressed. I need run it when I save files. The problem is: after I moved to 2013, and when I puch SAVE button, my rule cannot be run.
Does anyone how to solve this problem?
Solved! Go to Solution.
Thanks lot for your reply.
Unfortunately, I cannot post my model in. But I am copying the picture and my code as following.
SubMain()DimoutputfileAsStringDimmyFileNameAsStringDimmyOriginalManifoldAsStringDimmyReplaceManifoldAsStringmyFileName=ModelPartNumberoQuestion=MessageBox.Show("Do you want to save "&myFileName&"-E.ipt and "&myFileName&".iam at same time?", "Save", MessageBoxButtons.YesNo)IfoQuestion=vbYesTheniLogicVb.RunRule("Manifold", "Save File")myOriginalManifold=ThisDoc.PathAndFileName(False)&"-E.ipt"' without extension'MessageBox.Show("My Original Manifold file is " & myOriginalManifold, "Message")myReplaceManifold=ThisDoc.Path&"\"&myFileName&"-E.ipt"'MessageBox.Show("My Replace Manifold file is " & myReplaceManifold, "Message")outputfile=ThisDoc.Path&"\"&myFileName&".iam"Component.Replace("Manifold", myReplaceManifold, True)ThisDoc.Document.SaveAs(outputfile, True)Component.Replace("Manifold", myOriginalManifold, True)EndIfEnd Sub
I could run above code correctly if I seperately run it. But now I just want when I push "Save" button, the rule will be run.
If you could help to find it out, it will be much appreciated.
Oh, I see what your problem is. The rule wont trigger because it's suppressed. You have to unsuppress the rule in order for it to run when you save.
I assume you have it suppressed because you don't want it to randomly fire while your trying to draw. It shouldn't ever fire, bar on your triggered save event, unless a parameter that is referenced inside of the rule is changed. So, in your case, as long as the ModelPartNumber parameter doesn't get changed, you'll get the behaviour you expect. If you need to be able to change this parameter without triggering the rule, then I would filter the part number through an iProperty. That way you can change the paameter all day without triggering the rule, but still be able to reference it inside of the rule.
I hope all that made sense.
In the rule you posted above, change where you reference the ModelPartNumber parameter to instead reference the Part Number iProperty. This will stop the save rule from running on a change of part number, because properties can not trigger rules. Then unsuppress the save rule.
If you do this, then the only way that the rule will run is if you save the file, or you RMB on the rule in the iLogic browser and click run.
Got! Thanks lot.
It is working now.
And I need change to after Saving to rule the rule. Otherwise, Inventor give me "File Copy Error on Save" which is said "The system cannot find the path specified." when save the original file.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register