Problem:
When trying to use NXOpen to access the Zlevel Undercut operation in CAM the operation returns its type as "surface countour" causing a crash in the SurfaceCountourBuilder().
Solution:
Zlevel Undercut identifies as a "surface contour", however, a new builder has been created for this operation. You can work around this by using code similar to:
If TypeOf camObject Is CAM.SurfaceContour Then ' This is a Fixed Axis Surface Contour Operation
If camObject.GetNameOfType() = "Zlevel Undercut"
operationType = "Zlevel Undercut"
Else
operationType = "Surface Contour"
End If
Then creating a builder using the correctly identified operationType.
Alternatively, you can also call a new CreateBuilder method on any operation where the builder determines the proper builder to return:
{
For Each operation As NXOpen.CAM.Operation In setup.CAMOperationCollection()
operationBuilder = setup.CAMOperationCollection().CreateBuilder(operation) ' automatically finds the op type and chooses the correct builder to return.
}
Notes