Inventor Engineer-to-Order

Inventor Engineer-to-Order

Reply
Active Member
ChrisSuffell
Posts: 9
Registered: ‎12-07-2009
Message 1 of 4 (282 Views)
Accepted Solution

Passing Points and/or Vector as parameters to a VB .net function

282 Views, 3 Replies
02-12-2013 06:43 AM

Does anyone know of the best appraoch to passing Points and/or vectors as parameters to external functions written using VB.NET and incorperating Inventor API calls?

 

I would like to have a function written in Intent that looks something like:

 

Function iv_FooBar(PointParam As Point, VectParam as Vector) As String

.......

End Function

 

But I am unclear as to what the VB end needs to look like:

 

I was hoping to have something like:

 

Public SharedFunction iv_FooBar(ByVal PointParam As Inventor.ComponentOccurrence, ByVal VectParam as ????????) As String

 

But I guess it's not as simple as that!

 

Hi,

 

Can you please close the problem.

 

Regards,

-Ishwar N

Employee
nagwani
Posts: 33
Registered: ‎11-17-2011
Message 2 of 4 (260 Views)

Re: Passing Points and/or Vector as parameters to a VB .net function

02-14-2013 10:41 AM in reply to: ChrisSuffell

Hi There,

 

You just need to create Inventor point and vector using %%inventorapplication object in ETO 2012 or inventorapplication rule in 2013. Below is my Intent method which called external VB function with two arguments. I have also given the sample code of VB DLL.

 

Method TestExternalVB() As String
 Dim pt As Any = %%inventorapplication.transientgeometry.createpoint(10,10,100)
 Dim vec As Any = %%inventorapplication.transientgeometry.createvector(0,0,1)

 

 ' The name of DLL is ExternallVBFunction

 ' The name of Class is MyExternalFunctions

 ' The name of Function in class is iv_FooBar


 Dim customFunction As Any = New ExternallVBFunction.MyExternalFunctions()
 Dim s As String
 s=customFunction.iv_FooBar( pt,vec)
    Return s
End Method

 

 

 

'====================================== 

' Code of VB DLL

'======================================

 

Imports Autodesk.Intent.IntentAPI
Imports Inventor


Public Class MyExternalFunctions
    Public Function iv_FooBar(ByVal pt As Inventor.Point, ByVal vec As Inventor.Vector) As String
        Dim s As String
        s = "Point:" + CStr(pt.X) + "," + CStr(pt.Y) + "," + CStr(pt.Z)
        Return s
    End Function
End Class

Active Member
ChrisSuffell
Posts: 9
Registered: ‎12-07-2009
Message 3 of 4 (253 Views)

Re: Passing Points and/or Vector as parameters to a VB .net function

02-14-2013 11:37 PM in reply to: nagwani
Thanks for the assistance
Employee
nagwani
Posts: 33
Registered: ‎11-17-2011
Message 4 of 4 (246 Views)

Re: Passing Points and/or Vector as parameters to a VB .net function

02-15-2013 01:08 AM in reply to: ChrisSuffell

Hi,

 

Can you please close the problem.

 

Regards,

-Ishwar N

Announcements
Manufacturing Community
The Manufacturing Community provides additional access to tips, tutorials, blogs and networking with peers.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.