Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

CAM : NXMessageBox.Show

Status
Not open for further replies.

UserCFAO

Mechanical
Nov 12, 2007
44
hello ,

i would like to put all operation name in a message box
Can you help me ?
Code:
 
Replies continue below

Recommended for you

Code:
 Dim theSession As Session = Session.GetSession()
        Dim theUISession As UI = UI.GetUI
        Dim response As Integer
        Dim operationName(1) As String = ""
        operationName(0) = ""
 theUISession.NXMessageBox.Show("Question", NXMessageBox.DialogType.Question, operationName)]
 
I don't currently have access to a CAM license to test this, but I think it will do what you want.

Code:
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.CAM

Module Module2

    Sub Main(ByVal args As String())

        Dim theSession As Session = Session.GetSession()
        Dim theUI As UI = UI.GetUI()
        Dim dispPart As Part = theSession.Parts.Display
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Dim operationNames As New List(Of String)
        Dim opers As OperationCollection = dispPart.CAMSetup.CAMOperationCollection
        For Each oper As Operation In opers
            operationNames.Add(oper.Name)
        Next

        theUI.NXMessageBox.Show("Operation names", NXMessageBox.DialogType.Information, operationNames.ToArray)

    End Sub

End Module

www.nxjournaling.com
 
@cowski - I just tested it - works like a charm :*)

Mark Rief
NX CAM Customer Success
Siemens PLM Software
 
thanks @cowski it works great ! [thumbsup2]

A another question :

How you do , for just display the selection operation name and not all operations name ?

 
Untested code:

Code:
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.CAM

Module Module3

    Sub Main(ByVal args As String())

        Dim theSession As Session = Session.GetSession()
        Dim theUfSession As UFSession = UFSession.GetUFSession
        Dim theUI As UI = UI.GetUI()
        Dim dispPart As Part = theSession.Parts.Display
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Dim setupTag As Tag = Tag.Null

        theUfSession.Cam.InitSession()
        theUfSession.Setup.AskSetup(setupTag)

        If setupTag = Tag.Null Then
            lw.WriteLine("no CAM setup, journal exiting")
            Return
        End If

        Dim operationNames As New List(Of String)

        Dim selectedCount As Integer
        Dim selectedTags() As Tag

        ' Get the selected nodes from the Operation Navigator
        theUfSession.UiOnt.AskSelectedNodes(selectedCount, selectedTags)

        If selectedCount = 0 Then
            theUI.NXMessageBox.Show("Selected Operations", NXMessageBox.DialogType.Information, "No operations were selected")
            Return
        End If

        For Each tempTag As Tag In selectedTags
            Dim tempOp As Operation
            Try
                tempOp = Utilities.NXObjectManager.Get(tempTag)
                operationNames.Add(tempOp.Name)
            Catch ex As NXException
                'not an operation
            End Try
        Next

        If operationNames.Count = 0 Then
            theUI.NXMessageBox.Show("Selected Operations", NXMessageBox.DialogType.Information, "No operations were selected")
        Else
            theUI.NXMessageBox.Show("Selected Operations", NXMessageBox.DialogType.Information, operationNames.ToArray)
        End If


    End Sub

End Module

www.nxjournaling.com
 
that's exactly what I want , thanks for the support
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor