iCAx开思网

标题: Cam-yp VB.net 和 grip接口 [打印本页]

作者: zjs    时间: 2007-12-1 08:08
标题: Cam-yp VB.net 和 grip接口
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
'-----------------------------------------------
作者: cam-yp    时间: 2007-12-1 08:38
谢谢,不过我现在暂时不打算用.NET开发

VB.NET开发的程序不能在网络上运行,不知道为什么?
在本机上运行是没问题的
作者: luhongmo168    时间: 2007-12-1 09:06
谢谢。。。
作者: wensanren    时间: 2007-12-8 19:37
找寻很久,在这里撞到了
谢谢




欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3