---------------
How to loop through CMM Inspection tolerances to obtain values.
Solution
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.CAM
Module IR_7808455
Dim theSession As Session = Session.GetSession()
Dim theUFSession As UFSession = UFSession.GetUFSession()
Sub Main()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display
Dim allInspOps() As InspectionOperation =
workPart.InspectionSetup.CmmInspectionOperationCollection.ToArray()
For Each inspectionOperation1 As InspectionOperation In allInspOps
' Check the type and subtype:
Dim t As Integer = 0, st As Integer = 0
theUFSession.Obj.AskTypeAndSubtype(inspectionOperation1.Tag, t, st)
'Echo("Type: " & t & " Subtype: " & st)
If st.Equals(UFConstants.UF_insp_tolerance_subtype) Then
'Echo("**************************************** Executing
subtype conditional block")
Dim tolBldr As InspectionToleranceOperationBuilder = Nothing
Try
tolBldr =
workPart.InspectionSetup.CmmInspectionOperationCollection.CreateInspectionToler
anceOperationBuilder(inspectionOperation1)
If tolBldr IsNot Nothing Then
'MsgBox(inspectionOperation1.Name & " is a tolerance
operation")
Echo(" " & inspectionOperation1.Name & " is a
tolerance operation")
End If
tolBldr.Destroy()
Catch ex As Exception
' don't do anything - it was not what we were looking for.
End Try
End If
Next
End Sub
Sub Echo(ByVal output As String)
theSession.ListingWindow.Open()
theSession.ListingWindow.WriteLine(output)
theSession.LogFile.WriteLine(output)
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function
End Module
Notes and References
Hardware/Software Configuration
Platform: INTL64
OS: windows
OS Version: n/a
Product: NX
Application: CAM
Version: V10.0.3
Function: JOURNALING
Ref: 001-7808455