Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic - Straight VB Code - not seeing inventor dll

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
johnster100
341 Views, 2 Replies

iLogic - Straight VB Code - not seeing inventor dll

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

 

2 REPLIES 2
Message 2 of 3
C-Hoppen
in reply to: johnster100

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()

 

CHoppen_0-1623941880816.png

 

Regards

Christoph

Update: tested with Inventor 2021.3 Build 353

Message 3 of 3
johnster100
in reply to: C-Hoppen

thanks for the reply 🙂

 

works 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report