Autodesk Inventor Customization
- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Delete iLogic rule using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hallo,
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.
Re: Delete iLogic rule using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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)

Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.
Re: Delete iLogic rule using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
Regards,
m.giesau
Re: Delete iLogic rule using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.

Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.
Re: Delete iLogic rule using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
It is the same named rule in all files.
The files are stored in subdirectories.
I want to delete all rules.
m.giesau
Re: Delete iLogic rule using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Usage is:
DeleteRules.exe path rule extension1 extension2 ...
e.g.
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.
Re: Delete iLogic rule using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks a lot, that is this was I was looking for. I tried the tool and it works fine, all files are free of this rule.
Regards
m.giesau
Re: Delete iLogic rule using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Brent,
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!
Kenny
Boxx Technologies 4920 Xtreme
Windows 7 64-bit
Intel Core i7 3960X @ 4.5 GHz
32GB RAM
NVidia Quadro 4000 - NVidia Quadro 600 - NVidia Tesla C2075
Inventor Product Design Suite 2013 Ultimate - Vault Professional 2013 - Autodesk Simulation CFD 2013 - Bunkspeed Pro 2012
Certified Autodesk Inventor Professional - CAD Manager/Design Engineer
Re: Delete iLogic rule using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Kenny,
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.
Sincerely,
Brent Douglas
Re: Delete iLogic rule using VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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!
Kenny
Kenny
Boxx Technologies 4920 Xtreme
Windows 7 64-bit
Intel Core i7 3960X @ 4.5 GHz
32GB RAM
NVidia Quadro 4000 - NVidia Quadro 600 - NVidia Tesla C2075
Inventor Product Design Suite 2013 Ultimate - Vault Professional 2013 - Autodesk Simulation CFD 2013 - Bunkspeed Pro 2012
Certified Autodesk Inventor Professional - CAD Manager/Design Engineer



