Autodesk Inventor Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Launch External iLogic rule with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Is there someway to launch an external iLogic rule with VBA?. I'd like to add a button to run the iLogic rule.
Lance W.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
Solved! Go to Solution.
Re: Launch External iLogic rule with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This has been answered before, but perhaps not exactly this way...
--- In a VBA module ---
Public Sub LaunchMyRule1 <--- This is what you would tie to a button in a toolbar.
RuniLogic "MyRule1"
End sub
Public Sub LaunchMyRule2 <--- This is what you would tie to a button in a toolbar.
RuniLogic "MyRule2"
End sub
Public Sub RuniLogic(ByVal RuleName As String)
Dim iLogicAuto As Object
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
If oDoc Is Nothing Then
MsgBox "Missing Inventor Document"
Exit Sub
End If
Set iLogicAuto = GetiLogicAddin(ThisApplication)
If (iLogicAuto Is Nothing) Then Exit Sub
iLogicAuto.RunExternalRule oDoc, RuleName
End Sub
Function GetiLogicAddin(oApplication As Inventor.Application) As Object
Dim addIns As ApplicationAddIns
Set addIns = oApplication.ApplicationAddIns
Dim addIn As ApplicationAddIn
Dim customAddIn As ApplicationAddIn
For Each addIn In addIns
If (addIn.ClassIdString = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}") Then
Set customAddIn = addIn
Exit For
End If
Next
Re: Launch External iLogic rule with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks.
Lance W.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
Re: Launch External iLogic rule with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I can't get this to work and I can't figure out what's wrong. I have looked around and the only other code I can find doesn't work either.
Nevermind figured it out.
Public Sub LaunchMyRule1 <--- This is what you would tie to a button in a toolbar.
RuniLogic "MyRule1"
End sub
Public Sub LaunchMyRule2 <--- This is what you would tie to a button in a toolbar.
RuniLogic "MyRule2"
End sub
Public Sub RuniLogic(ByVal RuleName As String)
Dim iLogicAuto As Object
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
If oDoc Is Nothing Then
MsgBox "Missing Inventor Document"
Exit Sub
End If
Set iLogicAuto = GetiLogicAddin(ThisApplication)
If (iLogicAuto Is Nothing) Then Exit Sub
iLogicAuto.RunExternalRule oDoc, RuleName
End Sub
Function GetiLogicAddin(oApplication As Inventor.Application) As Object
Set addIns = oApplication.ApplicationAddIns
'Find the add-in you are looking for
Dim addIn As ApplicationAddIn
On Error GoTo NotFound
Set addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79
If (addIn Is Nothing) Then Exit Function
addIn.Activate
Set GetiLogicAddin = addIn.Automation
Exit Function
NotFound:
End Function
Lance W.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
Re: Launch External iLogic rule with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks a lot !
It works for Inventor 2012 too.
I just had to modify first line and add () :
Public Sub LaunchMyRule1 ()
RuniLogic "MyRule1"
End sub
...
Re: Launch External iLogic rule with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Mike,
I've tried using this in a VB6 program. I open up the part first that has the Rule I want to run, but I get an error saying it cannot find the external rule.
The error occurs at iLogicAuto.RunExternalRule oDoc, RuleName.
The RuleName is correct and the part does have a rule with the supplied name. Any suggestions?
Senior Designer/ CAD Programmer
Howden North America
Using Inventor 2013
Re : Launch External iLogic rule with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hello,
This VBA Code is made to launch an external rule only.
You have to link, in Inventor, an external iLogic rune, and not in the file.
Re : Launch External iLogic rule with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks for the reply, but how do I do that?
Senior Designer/ CAD Programmer
Howden North America
Using Inventor 2013
Re : Launch External iLogic rule with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Never mind. I just had to change
iLogicAuto.RunExternalRule oDoc, RuleName
to
iLogicAuto.RunRule oDoc, RuleName
Senior Designer/ CAD Programmer
Howden North America
Using Inventor 2013
Re: Launch External iLogic rule with VBA
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have Inventor pro 2012 but this code doesn't work! I need it can someone help me??????


