Output the tool feed distance of an operation

This is a manufacturing question. I am wondering if there is a way to read all of the operations in a program group and total up the sum of the feed distances the tool travels. The operations are Fixed-Contour with a Curve/Point drive method. All are center cutting operations. I don't care, or want, rapid or engage/retract distances included in the sum, just feed. Is there a way to do this in NXOpen?

Someone emailed in a similar question a number of months ago. I found some sample code from GTAC and modified it slightly (see below). Perhaps it can be used as a starting point for what you want to do.





Option Strict Off

Imports System
Imports System.Collections
Imports NXOpen
Imports NXOpen.CAM

Public Class NXJournal
Public Shared 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()

Try
Dim strHeader As String = "name, toolpath cutting length, toolpath cutting time, toolpath length, toolpath time"
lw.WriteLine(strHeader)

Dim opers As OperationCollection = dispPart.CAMSetup.CAMOperationCollection
For Each oper As Operation In opers
Dim strOperation As String = ""
strOperation &= oper.Name & ","
strOperation &= oper.GetToolpathCuttingLength.ToString & ","
strOperation &= oper.GetToolpathCuttingTime.ToString & ","
strOperation &= oper.GetToolpathLength.ToString & ","
strOperation &= oper.GetToolpathTime.ToString
lw.WriteLine(strOperation)
Next

Catch ex As NXOpen.NXException
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

I think that will help out a lot. I will give it a try and see. Thanks!

RVogel

This works just as I need. The oper.GetToolpathCuttingLength.ToString line retrieves the information for the operation I need. It does, however, also include the engage and retract distances in the sum. I will need to find a way to subtract those amounts from the sum, as well as confining the operations totaled to a selected program group. Thank you very much.

RVogel

Hi NXJouranling,
I have run the codes, but error is come out and shows the message:
Line 23: 'Operation' is ambiguous, imported from the namespaces or types 'NXOpen.CAM, NXOpen'.
I am using NX 12.0.2.9

Thank you.

Nice_day74

Try fully qualifying the definition of the variable:

For Each oper As NXOpen.CAM.Operation In opers

This should remove any ambiguity in the definition.

Thank you!

Nice_day74