Inventor General Discussion

Inventor General Discussion

Reply
Valued Contributor
gazadder
Posts: 64
Registered: ‎05-11-2007
Message 1 of 2 (247 Views)
Accepted Solution

VBA Macro Ilogic Issue

247 Views, 1 Replies
10-23-2013 07:16 AM

I am having an issue driving Ilogic rules from a VBA macro imported through Inventor VBA editor. Basically the only purpose of this macro is to run the very first Ilogic rule in an assembly that drives subsequent rules. However the problem I am having is when I fire the first rule with the macro then one of the subsequent rules (which are not related to the macro rule) behaves differently from when I fire the first rule manually. When I say behaves differently I mean it doesn’t recognise a line of code within the ilogic rule. I know the line of code could be placed into the macro but this is a simplified version of the problem and the code needs to be in Ilogic.

 

The line of code in the ilogic rule that seems to be not recognised when run via the macro is:-

 

ThisApplication.CommandManager.ControlDefinitions.?Item("AppZoomAllCmd").Execute

 

 

The VBA Macro is as follows:-

 

Attribute VB_Name = "iLogicAssy"

Public Sub RuniLogic()

 

Dim addIn As ApplicationAddIn

Dim addIns As ApplicationAddIns

Set addIns = ThisApplication.ApplicationAddIns

    For Each addIn In addIns

        If InStr(addIn.DisplayName, "iLogic") > 0 Then

                        addIn.Activate

            Dim iLogicAuto As Object

            Set iLogicAuto = addIn.Automation

            Exit For

        End If

    Next

Debug.Print addIn.DisplayName

 

 

Dim RuleName As String

RuleName = "FINAL_RULE_RUN"

 

  Dim oDoc As Document

 

  Set oDoc = ThisApplication.ActiveDocument

  If oDoc Is Nothing Then

    MsgBox "Missing Inventor Document"

    Exit Sub

  End If

 

  iLogicAuto.RunRule oDoc, RuleName

 

End Sub

Upgraded to 2014 and this is no longer an issue.

Valued Contributor
gazadder
Posts: 64
Registered: ‎05-11-2007
Message 2 of 2 (224 Views)

Re: VBA Macro Ilogic Issue

10-24-2013 03:27 AM in reply to: gazadder

Upgraded to 2014 and this is no longer an issue.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.