Community
Inventor Forum
Welcome to Autodeskā€™s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

delete rule with internal macro vba?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
celesiob
979 Views, 5 Replies

delete rule with internal macro vba?

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.

5 REPLIES 5
Message 2 of 6
DeerSpotter
in reply to: celesiob

Why would you want to do that? Go to ilogic, rules, select the rule and delete.

Image and video hosting by TinyPic
..........................................................................................................................
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
..........................................................................................................................


See My LinkedIn Profile
Message 3 of 6
DeerSpotter
in reply to: celesiob

Check this post out.

 

http://forums.autodesk.com/t5/Inventor-Customization/Delete-iLogic-rule-using-VBA/td-p/3082010

Image and video hosting by TinyPic
..........................................................................................................................
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
..........................................................................................................................


See My LinkedIn Profile
Message 4 of 6
celesiob
in reply to: DeerSpotter

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.

Message 5 of 6
celesiob
in reply to: DeerSpotter

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.

Message 6 of 6
celesiob
in reply to: celesiob

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report