UserCFAO
Mechanical
- Nov 12, 2007
- 44
hello ,
i would like to put all operation name in a message box
Can you help me ?
i would like to put all operation name in a message box
Can you help me ?
Code:
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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)]
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
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