×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

using a journal to call a grip program

using a journal to call a grip program

using a journal to call a grip program

(OP)
Hi Everyone
wondering if anyone can help me out. i am in need to call a grip program from a journal, and when it finishes have it pass control back to the journal. Is this possible ? If so does anyone have an example I could possibly use to get started. Appreciate anything you can tell me.

windows 7 and nx 8.0

Smitty
www.changes-consulting.com

RE: using a journal to call a grip program

This is possible, you will need to use the ExecuteGrip method. Below is a code sample from Siemen's GTAC solution center

CODE --> GTAC(vb)

'Date:  09/19/2007
'Subject:  Sample NX Open .NET Visual Basic program : call grip from vb and print args
'
'Note:  GTAC provides programming examples for illustration only, and
'assumes that you are familiar with the programming language being
'demonstrated and the tools used to create and debug procedures.  GTAC
'support professionals can help explain the functionality of a particular
'procedure, but we will not modify these examples to provide added
'functionality or construct procedures to meet your specific needs.

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
'----------------------------------------------- 

www.nxjournaling.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources