Showing results for 
Search instead for 
Did you mean: 

how to get tool list with the help of NX open code ?



Need a help in getting the tool list from nx open code (preffreably c#). I want the name of all the tools available as used/unused in machine tool navigator . The tool name should get output in listing window or a separate txt file.



Re: how to get tool list with the help of NX open code ?

Siemens Phenom Siemens Phenom
Siemens Phenom


There is an example program on the Solution Center that might be a good start, called


Sample CAM Visual Basic program : report all cam tools


This link may work:


If the link does not work, just search for "nx_api4709", and it should find it.  (It is VB, not C#.)



Re: how to get tool list with the help of NX open code ?

I am not sure how to cycle the machine tool navigator.

In the operation navigator, you can either cycle tools, or cycle operations and ask for their tool parents. If you want both used and unused tools, you need to cycle the tools.

Here is another sample api program - it cycles the operations, and reports with parent and reference tools are used:

' GetToolCycleAllOps.vb
'   Copyright 2015 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.
'     03-Aug-2015  Mark Rief   Original
' ===========================================================================
    ' This program will cycle through all the operations in the tool view and 
	' report their tools used.
' ============================================================================

Imports System 
Imports System.Collections 
Imports NXOpen 
Imports NXOpen.CAM 
Imports NXOpen.UF 
Imports NXOpen.Utilities 

Public Class report_all_oper_ref_cutters 
    Public Shared Sub Main(ByVal args As String()) 
            Dim theSession As Session = Session.GetSession() 
            Dim theUI As UI = UI.GetUI() 
            Dim theUfSession As UFSession = UFSession.GetUFSession() 
            Dim dispPart As Part = theSession.Parts.Display 
            Dim lw As ListingWindow = theSession.ListingWindow 
            Dim opers As OperationCollection = dispPart.CAMSetup.CAMOperationCollection 
            Dim en As IEnumerator = opers.GetEnumerator() 
            While en.MoveNext() 
                Dim oper As Operation = DirectCast(en.Current, Operation) 
				'Get the parent in the tool view
                Dim toolGroup As CAM.NCGroup = oper.GetParent(CAM.CAMSetup.View.MachineTool) 
				'Only tools (not pockets, Unused items, turrets, heads)
                If TypeOf toolGroup Is CAM.Tool Then					
					Dim cutter As Tool = DirectCast(toolGroup, Tool) 
					lw.WriteLine(" Tool Parent: " & cutter.Name) 
					lw.WriteLine(" No Tool") 
				End If

				'Also look for reference tool
				Dim ref_cutter_tag As Tag = Tag.Null 
				theUfSession.Oper.AskRefCutter(oper.Tag, ref_cutter_tag) 
				If ref_cutter_tag <> Tag.Null Then 
					Dim ref_cutter As Tool = DirectCast(NXObjectManager.[Get](ref_cutter_tag), Tool) 
					lw.WriteLine(" Reference Tool: " & ref_cutter.Name) 
					lw.WriteLine(" No Reference Tool") 
				End If
            End While 
        Catch ex As NXOpen.NXException 
            ' end try 
            UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.[Error], ex.Message) 
        Catch ex As Exception 
            UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.[Error], ex.Message) 
        End Try 
    End Sub 
End Class 
Mark Rief
Retired Siemens