good day,
someone from the forum knows the code to delete an internal rule of a document using a macro vba?
thank you in advance for now.
Solved! Go to Solution.
Why would you want to do that? Go to ilogic, rules, select the rule and delete.
Check this post out.
http://forums.autodesk.com/t5/Inventor-Customization/Delete-iLogic-rule-using-VBA/td-p/3082010
the company where I am working on a customization was initially conducted using iLogic due to complessidade this need for customization and aperfessuar the same, we are migrating to vba, however constumização generates complito old with the new, due to existing internal parameters, and avoid this problem the best solution is to eliminate the old rule exists internally in the file, because all actions are performed through a form created in vba, I hope you consseguido justify my need.
I've tried using this code but not watch out for my purpose, my goal is elimiar the existing rule only when necessary, such a solution is to delete all the rules in a specified folder. that is not what I precisso, already tried adptar the same for my situation and not got success.
I found a solution to my problem, the following code deletes all the rules of the active document serves to cituação mine, but if anyone knows a way to delete a certain specific rule by name I would appreciate it.
Sub deleteRULE()
Dim i As Object
Set i = GetiLogicAddin(ThisApplication)
Dim oDoc As Inventor.Document
Set oDoc = ThisApplication.ActiveDocument
'' This will delete all rules in the document
Call i.DeleteAllRulesInDocument(oDoc)
End Sub
Function GetiLogicAddin(ByVal oApplication As Inventor.Application) As Object
Dim addIns As ApplicationAddIns
Set addIns = oApplication.ApplicationAddIns
Dim addIn As ApplicationAddIn
On Error GoTo NotFound
Set addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}")
If (addIn Is Nothing) Then
Set GetiLogicAddin = Nothing
Exit Function
End If
Call addIn.Activate
Set GetiLogicAddin = addIn.Automation
Exit Function
NotFound:
End Function