|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
VB.net
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpenUI
Imports NXOpen.UI
Imports NXOpen.Utilities
Module call_grip_from_vb_and_print_args
Dim s As Session = Session.GetSession()
Dim ui As UI = GetUI()
Sub Main()
Try
Dim num1 As Double = 2.0
Dim num2 As Double = 55.2
Dim text1 As String = "Otto"
Dim text2 As String = "Karl"
Dim inputArgs(3) As Object
Dim gripObj() As Object
inputArgs(0) = num1
inputArgs(1) = num2
inputArgs(2) = text1
inputArgs(3) = text2
ui.LockAccess()
Dim grip_executable As String = "c:\print_api_args.grx"
gripObj = s.ExecuteGrip(grip_executable, inputArgs)
ui.UnlockAccess()
Catch ex As Exception
s.ListingWindow.Open()
s.ListingWindow.WriteLine("Error: ")
s.ListingWindow.WriteLine(ex.GetBaseException.ToString())
End Try
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function
End Module
'-----------------------------------------------
'$$ GRIP Source called by VB.NET
'$$ Please remove the first character
'$$ in each line to compile!
'$$
'$$ Declarations.
' number / zahl1, zahl2
' entity / object
' string / text1(132), text2(132)
'
'$$ Register and initialize the argument list
' ufargs / zahl1, zahl2, text1, text2
'
'$$ Print the arguments
' PRINT/ 'Argument1 = ' + FSTR(zahl1)
' PRINT/ 'Argument2 = ' + FSTR(zahl2)
' PRINT/ 'Argument3 = ' + text1
' PRINT/ 'Argument4 = ' + text2
'
'$$ Return control to the VB program.
' halt: halt
'----------------------------------------------- |
|