How to Call NXOpen From KF
How to Call NXOpen From KF
(OP)
Dear Forum,
I must be doing something wrong here. This shouldn't be a difficult problem. I want to be able to call an NXOpen dll from KF.
Here's my KF code:
@{
$result << nx_ja_session_execute( "C:\Temp\CurvatureAnalysis.dll", "CurvatureAnalysis", "Echo", { "Hello Here I am"} );
ug_printvalues(stringvalue($result));
true ;
};
Here's my NXOpen code:
Option Strict Off
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports NXOpen.Features
Public Class CurvatureAnalysis
Private theSession As Session
Private theUFsession As UFSession
Private workPart As Part
Private displayPart As Part
Private theUI As UI
Sub Main()
theSession = Session.GetSession()
workPart = theSession.Parts.Work
displayPart = theSession.Parts.Display
theUI = UI.GetUI()
theUFsession = UFSession.GetUFSession()
End Sub
Public Sub Echo(ByVal output As String)
theSession.ListingWindow.Open()
theSession.ListingWindow.WriteLine(output)
theSession.LogFile.WriteLine(output)
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function
End Class
I must be doing something wrong here. This shouldn't be a difficult problem. I want to be able to call an NXOpen dll from KF.
Here's my KF code:
@{
$result << nx_ja_session_execute( "C:\Temp\CurvatureAnalysis.dll", "CurvatureAnalysis", "Echo", { "Hello Here I am"} );
ug_printvalues(stringvalue($result));
true ;
};
Here's my NXOpen code:
Option Strict Off
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports NXOpen.Features
Public Class CurvatureAnalysis
Private theSession As Session
Private theUFsession As UFSession
Private workPart As Part
Private displayPart As Part
Private theUI As UI
Sub Main()
theSession = Session.GetSession()
workPart = theSession.Parts.Work
displayPart = theSession.Parts.Display
theUI = UI.GetUI()
theUFsession = UFSession.GetUFSession()
End Sub
Public Sub Echo(ByVal output As String)
theSession.ListingWindow.Open()
theSession.ListingWindow.WriteLine(output)
theSession.LogFile.WriteLine(output)
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function
End Class




