cancel
Showing results for 
Search instead for 
Did you mean: 

Drilling depth

Pioneer
Pioneer

I am trying to retieve the depth of drilling operations using NXOpen. Most other operations have a "Depth" parameter, but not any of the drilling operations that I can see.

 

In the Operation Navigator there is a "Depth of Cut" column. That's the value I'm looking for, but not sure where it is.

 

Anybody know how to retieve this value?

8 REPLIES

Re: Drilling depth

Esteemed Contributor
Esteemed Contributor

What kind of drilling operation, hole_making.DRILLING of NX 10.0.3?

 

The following changes the value of the depth for the above mentioned operation type, so you should get a hint on how to retrieve that value.

 

'
' Created by SharpDevelop.
' User: Stefan.Pendl
' Date: 17.02.2016
' Time: 14:02
' 
' To change this template use Tools | Options | Coding | Edit Standard Headers.
'

Option Strict Off
Imports System
Imports System.IO
Imports System.Windows.Forms
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Utilities

Module CamCorrectPilotHole
    Dim theSession    As Session   = Session.GetSession()
    Dim theUFSession  As UFSession = UFSession.GetUFSession()
    Dim theUI         As UI        = UI.GetUI()
    Dim TempPath      As String    = Environment.GetEnvironmentVariable("TMP")
    Dim UGRelease     As String    = Nothing
    Dim UGFullRelease As String    = Nothing
    
    Sub Main(Args As String())
        theSession.LogFile.WriteLine("Executing ... " & _
            System.Reflection.Assembly.GetExecutingAssembly().Location)
        
        Threading.Thread.CurrentThread.CurrentCulture = New Globalization.CultureInfo("en-US")
        Threading.Thread.CurrentThread.CurrentUICulture = New Globalization.CultureInfo("en-US")
        
        UGRelease = theSession.GetEnvironmentVariableValue("UGII_VERSION")
        UGFullRelease = theSession.GetEnvironmentVariableValue("UGII_FULL_VERSION")
        
        System.Windows.Forms.Application.EnableVisualStyles()
        
        Dim MyUndoMark As Session.UndoMarkId = _
            theSession.SetUndoMark(Session.MarkVisibility.Visible, "CamCorrectPilotHole")
        
        ' uncomment the following lines to check for the correct application
        'Dim AppID As Integer = UFConstants.UF_APP_NONE
        'theUFSession.UF.AskApplicationModule(AppID)
        'If AppID <> UFConstants.UF_APP_CAM Then
        '    theUI.NXMessageBox.Show("Application missmatch", NXMessageBox.DialogType.Error, "No NX CAM session, Exiting!")
        '    Exit Sub
        'End If
        
        Dim theHoleDrillingBuilder As CAM.HoleDrillingBuilder = Nothing
        
        For Each theOperation As CAM.Operation In theSession.Parts.Work.CAMSetup.CAMOperationCollection
            If theOperation.Name.StartsWith("BOHR_S1P_PILOT", StringComparison.InvariantCultureIgnoreCase) Then
                theHoleDrillingBuilder = _
                    theSession.Parts.Work.CAMSetup.CAMOperationCollection.CreateHoleDrillingBuilder(theOperation)
                
                Dim theFeatureGeometry As CAM.FBM.FeatureGeometry = theHoleDrillingBuilder.GetFeatureGeometry()
                Dim theMachiningFeatureGeometry As CAM.FBM.MachiningFeatureGeometry = _
                    CType(theFeatureGeometry, CAM.FBM.MachiningFeatureGeometry)
                
                Dim theFeatureSet As CAM.FBM.FeatureSet = Nothing
                Dim theFeature As CAM.FBM.Feature = Nothing
                
                For i As Integer = 0 To theMachiningFeatureGeometry.GeometryList.Length - 1
                    theFeatureSet = theMachiningFeatureGeometry.GetFeatureSet(i)
                    theFeature = theFeatureSet.GetFeature()
                    
                    If theOperation.Name.Contains("AMEC") Then
                        theFeature.OverrideAttributeValue("DEPTH", 1.2)
                    Else
                        theFeature.OverrideAttributeValue("DEPTH", _
                            Math.Max(theOperation.GetParent(CAM.CAMSetup.View.MachineTool).GetRealValue("Tool Diameter") * 2.0, _
                            17.0))
                    End If
                Next i
            End If
        Next
        
        Dim MyUpdateUndoMark As Session.UndoMarkId = _
            theSession.SetUndoMark(Session.MarkVisibility.Invisible, "UpdatePilotHole")
        theSession.UpdateManager.DoUpdate(MyUpdateUndoMark)
        
        Dim Dummy As NXOpen.NXObject = theHoleDrillingBuilder.Commit()
        theHoleDrillingBuilder.Destroy()
    End Sub
    
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        Return CInt(Session.LibraryUnloadOption.Immediately)
    End Function
End Module
Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Drilling depth

Pioneer
Pioneer

"What kind of drilling operation, hole_making.DRILLING of NX 10.0.3?"

 

Any drilling/tapping operation.

 

Thank you for the code, I tried it out and get an error:

"Builder has no object assigned"

 

I know there is an object, but it must be the wrong type? .GetType returns "NXOpen.CAM.Operation" and .AskTypeAndSubType returns  100 & 450. ("UF_machining_operation_type" & "UF_mach_point_to_point_subtype" respectively from uf_object_types.h)

 

The CAM program I'm currently testing with has a spot driiling op, 2 peck drilling ops, a reaming op, and a tapping op.

 

I have a program that creates custom shopdocs using drafting sheets...I have been asked to add the cut depth of the operations. So far I've only been successful with FaceMilling operations.

Re: Drilling depth

Esteemed Contributor
Esteemed Contributor

The code is not working for P2P operations, only for the new drilling operations introduced in NX 9.

Attached find a small journal to get all the parameters available for an operation of any type.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Drilling depth

Pioneer
Pioneer

I have that file, I think you gave it to me a couple years ago. Smiley Happy

 

Not all the operations have a depth parameter, and the ones that do the settings don't always jive with the parameter value. It's confusing because there is a depth shown in the operation navigator for nearly every operation, and it matches the settings...but I can't find where that value is coming from.

 

Thanks for your help!

Re: Drilling depth

Esteemed Contributor
Esteemed Contributor

P2P is only fully supported by GRIP and NXOpen C, so the C-wrapper functions of NXOpen .NET should be able to get the information.

I some cases the depth is not a single value, but contained in an object set.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Drilling depth

Esteemed Contributor
Esteemed Contributor

May be you can succeed by using the wrapper method for UF_CAMGEOM_ask_custom_points.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Drilling depth

"Depth" is not a simple parameter.

 

For legacy point to point operations, the Operation Navigator column displays either the cycle depth (tip or shoulder), or the text "Model" if it is model depth. To get the cycle depth you will probably need GRIP.

 

For hole making operations, the depth is often derived from the geometry, so a number may not be saved in the operation -- it is in the tool path.

 

Have you considered using post or shopdocs instead? These both set mom variables for the cycle_feed_to_pos, which is what I think you are after.

Mark Rief
Retired Siemens

Re: Drilling depth

Pioneer
Pioneer
Stefan, thank you for your help. I'll dig around some more and see if I can find a way in with the wrappers.

Mark, most operations show me a depth. A few, as you mentioned, show text. The drilling cycles are what I'm really after. Even in point to point operations it displays a depth, but I cannot retrieve that number as of yet.

We used shopdocs for a short while but they are difficult to modify to the output we wanted. So I have written my own version that is far easier to modify and gives us the info we need. Well, except for depth. Smiley Happy