i have an iLogic rule in serveral files. Now this rule has to be deleted. This should be done with VBA. I can not find any function to delete a rule using VBA.
I found a function iLogicAuto.RunRuleDirect(rule), but not iLogicAuto.DeleteRule(rule) ...
I can not find any documentation for iLogic/VBA.
Please help me.
Are all the files contained in one assembly? Do you want to delete all the rules? If so, you can use the Delete All Rules command on the ribbon under Manage -> iLogic.
Or do you want to delete only one rule, and leave other rules intact? How many files do you need to modify? Are they all in a single directory?
The function to delete a rule is:
iLogicAuto.DeleteRule(ByVal doc As Inventor.Document, ByVal ruleName As String)
Thank's a lot, that was easy....(for you)... this time we have 800 files, maybe you have an idea how to find the files with the wrong rule? The files are in different directorys.
Does the wrong rule have the same name in all the files?
Are all the files stored in subdirectories of a single directory?
Please confirm: You don't want to delete all rules. You only want to delete one "wrong" rule in each file.
I knocked up a command line utility to do what I think you're looking for based on http://forums.autodesk.com/t5/Autodesk-Inventor-Cu
DeleteRules.exe path rule extension1 extension2 ...
This deletes the rule 'rule' from all files with the extension '.ipt' and '.iam' in the folder passed in and any and all subfolders on that path.
I know this is an old post but I think your post might be the solution I'm looking for. I have zero knowledge of VB outside of Inventor iLogic. I have dowloaded your files but how do I go about using them?
Basically I need to remove all ilogic from thousands of files. The ilogic codes can vary in name ie: "rule0", "rule1", "part_rule", "SM_rule", etc. Most are "rule0" though.
We use Vault Pro. The files are within different subfolders ie: file 12345 is in subfolder 12000, file 14756 is in subfolder 14000, etc.
Anyone that can help it would be greatly appreciated!
The first thing I would do when using it is back up your files. I would also make a third copy that you run this on specifically to test that this does what you are looking for.
First step to use it is to unzip the files. I imagine windows has a built in tool for this, if not google should show you how to do this without too much trouble. The file you want to use is called DeleteRules.exe in the root of the zip.
To use it you should execute it from the command line. To do this go to Run in the start menu and type cmd. You can also get to it from Start -> Accessories -> Command Prompt
You should see a black screen with something line:
C:\Documents and Setting\Kenny>
From here you need to write 3 things seperated by spaces:
- The path of DeleteRules.exe that you downloaded
- The location of the folder containing the files that you want the rules deleted from
- The extension of the files you want to delete the rules from
For example lets say you extracted that zip to C:\Documents and Setting\Kenny\Downloads\TheZip and you keep all your inventor files that you want to delete the rules from in C:\Documents and Setting\Kenny\Work\SomeProject and in this particular case you only want to delete the rule "rule0" from your part files (not assemblies or other inventor file) you would type:
C:\Documents and Setting\Kenny\Downloads\TheZip\DeleteRules.exe C:\Documents and Setting\Kenny\Work\SomeProject rule0 .ipt
This will delete any rules called rule0 from any .ipt file in the SomeProject directory (and any sub-directories). With the Vault directory structure, it soulds like you should point it to the parent folder of the 14000, 15000, etc folders which will cover all the sub folders (This will remove the rule from every part in these folders though). If you wanted to do delete rule0 from both parts and assemblies but only from the subfolder 15000 you would use:
C:\Documents and Setting\Kenny\Downloads\TheZip\DeleteRules.exe C:\Documents and Setting\Kenny\Work\SomeProject\15000 rule0 .ipt .iam
For rules with different names you will need to rule that command once per rule with rule0 changed to whatever your rule is called.
Let me know if I have explained this ok and if this cover's what you are looking for. If this isn't what you need I might have a look at it changing it to be more appropriate tonight. I haven't used inventor since about the time I wrote the last post though so I won't promise anything.
Wow thanks Brent!! I was able to do this using a different method and the long way around you could say but I will try yours and let you know how it goes. Thanks again!
Access a broad range of knowledge to help get the most out of your products and services.
Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.
Upgrading to a 2015 product? Make sure to check these out 1st!