- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to get my VB.net program to run internal iLogic rules. I've done a lot of searching on the web & in these forums but still can't seem to make my program work. Here's the current module that I'm trying to get working:
Imports Inventor
Imports System.IO
Module modiLogic
Private iLogicAuto As Object
Private invApp As Inventor.Application
Public Sub RuniLogicRule(ByVal RuleName As String)
On Error Resume Next
iLogicAuto = GetiLogicAddin(invApp)
If iLogicAuto Is Nothing Then Exit Sub
Dim oDoc As Inventor.Document = invApp.ActiveDocument
iLogicAuto.RunRule(oDoc, RuleName)
oDoc = Nothing
On Error GoTo 0
End Sub
Function GetiLogicAddin(oApplication As Inventor.Application) As Object
' Get addin collection & addin variables
GetiLogicAddin = Nothing
Dim addIns As ApplicationAddIns = oApplication.ApplicationAddIns
Dim addIn As ApplicationAddIn
Dim customAddIn As ApplicationAddIn = Nothing
For Each addIn In addIns
If (addIn.ClassIdString = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}") Then
customAddIn = addIn
Exit For
End If
Next
If (customAddIn Is Nothing) Then
Exit Function
Else
customAddIn.Activate()
Return customAddIn.Automation
End If
End Function
End Module
Here is an internal iLogic rule I am trying to run from VB.net:
If FlgType = "RF Weld-Neck Flange" Then FlgStBk = Parameter("SHELL_FLG", "Y") + Parameter("SHELL_FLG", "RF") + WeldGap ElseIf FlgType = "RJ Weld-Neck Flange" Then FlgStBk = Parameter("SHELL_FLG", "Y") + Parameter("SHELL_FLG", "RF") + WeldGap ElseIf FlgType = "RF Slip-On Flange" Then inc = .0625 ' rounding increment ( .125, .25, .5, etc) FlgStBk = Ceil(Round(Parameter("SHELL_PIPE", "t") + .0625,4) / inc) * inc ElseIf FlgType = "RJ Slip-On Flange" Then inc = .0625 ' rounding increment ( .125, .25, .5, etc) FlgStBk = Ceil(Round(Parameter("SHELL_PIPE", "t") + .0625,4) / inc) * inc End If InventorVb.DocumentUpdate()
Here is how I'm calling out the sub:
Private Sub btnTestiLogic_Click(sender As Object, e As EventArgs) Handles btnTestiLogic.Click
CheckInventor()
RuniLogicRule("ShellPipeSize")
End Sub
When I press the "btnTestiLogic" button, nothing happens.
Could somebody please give me some advice to help fix this?
Solved! Go to Solution.