Inventor General

Reply
Contributor
celesiob
Posts: 15
Registered: ‎02-15-2013
Message 1 of 6 (207 Views)
Accepted Solution

delete rule with internal macro vba?

207 Views, 5 Replies
11-08-2013 05:19 AM

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.

Distinguished Contributor
m.teleguz1
Posts: 189
Registered: ‎04-01-2013
Message 2 of 6 (187 Views)

Re: delete rule with internal macro vba?

11-08-2013 08:38 AM 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.
..........................................................................................................................
Privacy warning: Since I live in a country that has traded liberty for the illusion of security, all of your posts to me are being monitored and saved by the United States Government.

Distinguished Contributor
m.teleguz1
Posts: 189
Registered: ‎04-01-2013
Message 3 of 6 (181 Views)

Re: delete rule with internal macro vba?

11-08-2013 08:40 AM 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.
..........................................................................................................................
Privacy warning: Since I live in a country that has traded liberty for the illusion of security, all of your posts to me are being monitored and saved by the United States Government.

Contributor
celesiob
Posts: 15
Registered: ‎02-15-2013
Message 4 of 6 (175 Views)

Re: delete rule with internal macro vba?

11-08-2013 08:46 AM in reply to: m.teleguz1

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.

Contributor
celesiob
Posts: 15
Registered: ‎02-15-2013
Message 5 of 6 (169 Views)

Re: delete rule with internal macro vba?

11-08-2013 08:50 AM in reply to: m.teleguz1

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.

Contributor
celesiob
Posts: 15
Registered: ‎02-15-2013
Message 6 of 6 (138 Views)

Re: delete rule with internal macro vba?

11-27-2013 10:58 AM 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube