Hi,
I'm trying to create an external rule with some common functions I can call from other ilogic rules. To do this I've created the external rule, defined a class and selected straight vb code from the options:
Imports Inventor
Public Class Test
Public Shared Sub Test()
Dim oDrawDoc As Inventor.DrawingDocument
End Sub
End Class
when I call the function from my ilogic rule I get the error:
Type 'Inventor.DrawingDocument' is not defined.
what am I doing wrong?
thanks for any help,
John
Solved! Go to Solution.
Solved by C-Hoppen. Go to Solution.
John
This works to me. Propably it can give you a hint.
Plain text from "Test.Vb"
' <IsStraightVb>True</IsStraightVb>
Imports System.Windows.Forms
Imports Inventor
Public Class Test
Private Property ThisDoc As ICadDoc
Public Sub New(thisDoc As ICadDoc)
Me.ThisDoc = thisDoc
End Sub
Public Sub Main
Dim oDrawDoc As DrawingDocument
If ThisDoc.Document.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
oDrawDoc = ThisDoc.Document
MessageBox.Show(oDrawDoc.Sheets.Count, "No of Sheets")
Else
MessageBox.Show("Only for Drawing Documents!", "No Of Sheets")
End If
End Sub
End Class
Calling "Test.Main()" from another rule:
'Header --->
AddVbFile "C:\Users\chris\xxxxxxxxxxx\Test.vb"
'<--- Header
Dim test As New Test(ThisDoc)
test.Main()
Regards
Christoph
Update: tested with Inventor 2021.3 Build 353
Can't find what you're looking for? Ask the community or share your knowledge.