×
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

CAM : NXMessageBox.Show

CAM : NXMessageBox.Show

CAM : NXMessageBox.Show

(OP)
hello ,

i would like to put all operation name in a message box
Can you help me ?

CODE --> operationName)

 

RE: CAM : NXMessageBox.Show

(OP)

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)] 

RE: CAM : NXMessageBox.Show

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

RE: CAM : NXMessageBox.Show

@cowski - I just tested it - works like a charm :*)

Mark Rief
NX CAM Customer Success
Siemens PLM Software

RE: CAM : NXMessageBox.Show

(OP)
thanks @cowski it works great ! thumbsup2

A another question :

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

RE: CAM : NXMessageBox.Show

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

RE: CAM : NXMessageBox.Show

(OP)
that's exactly what I want , thanks for the support

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