Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

journal to change traversal feed rates

Status
Not open for further replies.

JAYDEE66

Aerospace
Jan 6, 2020
13
I am looking for a journal that will change all non rapid traversal feed rates to a new value.
It will change all the paths in the program group or all selected paths. Is there anything like that out there?
Thank you
 
Replies continue below

Recommended for you

I have not tried much. My journal skills are limited. Any help you can give me would be appreciated. one of my biggest problems is cycling the operations to check for rapids vs traversal feeds.

thank you
 
I have made some progress but need a little help please.

I am working on a journal that updates the Traversal feed rate on operations within a program. I would like to get the Traversal feed rate value and unit for a given NXOpen.CAM.Operation. I see the function CAMObject.GetFeedRate, but I do not understand the parameters. The first parameter is a string, "the name of the parameter index". Should this be "Traversal"? The second parameter is a double value. I do not understand this parameter.

thank you
 
Hi ,
Sorry for the delay…
You should try to register a 'journal' (Menu > Tools > Journal > save…) , this may help you that said…
You are right the first parameter is string in your case it's "Feed Traversal" the second it's value of feed
Below an example (works if the selection is an "operation")

Code:
Option Strict Off

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

Module GetFeedTraversal

    Dim theSession As Session     = Session.GetSession()
    Dim theUfSession As UFSession = UFSession.GetUFSession()
    Dim workPart As Part          = theSession.Parts.Work
    Dim lw As ListingWindow       = theSession.ListingWindow


    Sub Main()
		
	lw.Open()

        Dim setupTag As Tag
        Dim selectedTags() As NXOpen.Tag
        Dim selectedCount As Integer
        Dim theUI As UI = UI.GetUI()
        
        theUfSession.Setup.AskSetup(setupTag)
        
        If setupTag <> 0 Then
	
           
            theUfSession.UiOnt.AskSelectedNodes(selectedCount, selectedTags)
            
            If selectedCount = 0 Then
                theUI.NXMessageBox.Show("Error : ", _
                                        NXMessageBox.DialogType.Error, _
                                        "No selected operation...")
                Exit Sub
            End If
			
            Dim op As NXObject
			Dim feedtraversal As Double = 0
           
	     For i As Integer = 0 To selectedCount - 1
			
		Try
			
                    op = NXObjectManager.Get(selectedTags(i))
                    Dim operation As CAM.Operation = CType(op, CAM.Operation)
				
		    Dim FeedUnit As CAM.FeedRateUnit = operation.GetFeedRate("Feed Traversal", feedtraversal)
                    lw.WriteLine(operation.name())
                    lw.WriteLine("Traversal Feedrate : " & feedtraversal.ToString & "/" & FeedUnit.ToString)
                    
		Catch ex As NXOpen.NXException
			lw.Writeline(ex.ToString())
		End Try
                    
            Next
            
        End If

    End Sub
    
End Module




 
I'm not sure what this means.

You should try to register a 'journal' (Menu > Tools > Journal > save…)

now, having said that I believe I have what i want in the journal and I will share it after I do some testing

thank you for your help
 
I have this program running perfectly and I will share the code once I make a small change listed below.
when I run the journal I have to cut and paste the name of the program group. I would like to run the journal and click on the program group I want to use instead of the cut and paste,

any help would be appreciated,

thank you
 
Here is the finished journal that changes the Traversal IMP value in all operations in a selected PROGRAM GROUP.
Thank you UserCFAO for all your help with this project.


Code:
Option Strict Off

Imports NXOpen
Imports NXOpen.CAM
Imports NXOpen.UF
Imports NXOpen.UF.UFoper
Imports NXOpen.Utilities
Imports NXOpenUI
Imports System
Imports System.IO

Module IPMTraversalFeedRateEditor
  Dim updatableMillingOperationSubTypes = New Collections.Generic.Dictionary(Of Integer, String) From {
      { 110,  "Planar mill profile / pocket operation" },
      { 210,  "Fixed axis surface contouring" },
      { 211,  "Variable axis surface contouring" },
      { 220,  "Unknown (UF_mach_point_to_point_subtype)" },
      { 260,  "Cavity milling" },
      { 261,  "Face milling" },
      { 262,  "Volume milling" },
      { 263,  "Z-Level milling" },
      { 265,  "Plunge milling" },
      { 266,  "Variable axis Z-Level" },
      { 1700, "Thread milling" },
      { 3100, "Groove milling" },
      { 3300, "Radial groove milling operation" },
      { 2700, "Cylinder milling" },
      { 3200, "Chamfer milling" }
  }

  Sub Main()
    ' Read selected item by the user. It should be a single program group.
    Dim selectedTags() As NXOpen.Tag
    Dim selectedCount As Integer
    UFSession.GetUFSession().UiOnt.AskSelectedNodes(selectedCount, selectedTags)
    If selectedCount <> 1 Then
      UI.GetUI().NXMessageBox.Show("Error : ", NXMessageBox.DialogType.Error, "You must select exactly one program group.")
      Exit Sub
    End If

    ' Cast selected item to program group.
    Dim programGroup As CAM.NCGroup
    Try
      programGroup = CType(NXObjectManager.Get(selectedTags(0)), CAM.NCGroup)
    Catch ex As InvalidCastException
      UI.GetUI().NXMessageBox.Show("Error : ", NXMessageBox.DialogType.Error, "You must select a program group.")
      Exit Sub
    Catch ex As OverflowException
      UI.GetUI().NXMessageBox.Show("Error : ", NXMessageBox.DialogType.Error, "You must select a program group.")
      Exit Sub
    End Try 

    ' Prompt for the new feed traversal feed rate and convert to a number.
    Dim newFeedRateValue As Double = Convert.ToDouble(NXInputBox.GetInputString("Enter new traversal feed rate", "Feed Traversal Rate Editor", "475"))

    ' Get all operations that are part of the program group.
    Dim operations As New System.Collections.Generic.List(Of CAM.Operation)
    For Each member As CAM.CAMObject In programGroup.GetMembers()
      If TypeOf member Is CAM.Operation
        operations.Add(CType(member, CAM.Operation))
      End If
    Next
    
    Dim listingWindow As ListingWindow = Session.GetSession().ListingWindow
    listingWindow.SelectDevice(ListingWindow.DeviceType.Window, "")
    listingWindow.open()

    ' Iterate over operations. Update milling operations with IPM traversal feed rates.
    For Each operation As CAM.Operation In operations
      'Get the type and subtype of the operation.
      Dim operationType As Integer
      Dim operationSubtype As Integer
      UFSession.GetUFSession().Obj.AskTypeAndSubtype(operation.tag, operationType, operationSubtype)

      ' Update milling operations with IPM traversal feed rates. Skip others.
      If updatableMillingOperationSubTypes.ContainsKey(operationSubtype) Then
        Dim objectsFeedsBuilder As CAM.ObjectsFeedsBuilder = Session.GetSession().Parts.Work.CAMSetup.CreateFeedsBuilder(New CAM.CAMObject() { operation })
        Dim feedTraversal As CAM.InheritableFeedBuilder = objectsFeedsBuilder.FeedsBuilder.FeedTraversalBuilder
        Dim oldFeedRateValue As Double = feedTraversal.Value

        If feedTraversal.Unit = CAM.FeedRateUnit.PerMinute Then
          feedTraversal.Value = newFeedRateValue
          objectsFeedsBuilder.Commit()
              ListingWindow.WriteLine(operation.Name & " - Traversal feed rate updated from " & oldFeedRateValue & " to " & newFeedRateValue)
        End If
        objectsFeedsBuilder.Destroy()
      End If
    Next

    listingWindow.Close()

  End Sub

End Module
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor