I am cycling through a collection of camObjects. When on of the objects is an operation, I want to determine which machine Method it is attached to, and use some logic to set machining data for that operation.
What is the appropriate technique for identifying the method? Am I to use GetParent, and cycle the array to find the object that is type CAM.Method?
I'm afraid I am baffled by the object hierarchy.
Are you cycling through the operation collection or the members of the ONT method view?
To get the method from the operation object, you use the GetParent() method with the CAMSetup.View.MachineMethod, see the description of the CAM.Operation object in the NXOpen .NET API reference.
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: NX12.0
How to Get the Most from Your Signature in the Community
An nxopen.cam.Operation object has a method getParent() that takes one of the nxopen.cam.CAMSetup.View members. So to get the method parent group you would do something like:
NCGroup methodGroup = myOp.getParent(nxopen.cam.CAMSetup.View.MACHINE_METHOD);
Gah, @Stefan_Pendl you beat me to it
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | KF
Production: NX126.96.36.199 MP11 64bit Testing: NX188.8.131.52
There was a new document shipped with NX10 called "SNAP and NX Open for GRIP Enthusiasts". The title is more limiting than it should be, because the document is useful even if you've never used GRIP before. It has a section on NX Open for CAM, which includes a description of the object hierarchy. In part, it says:
Within a given setup, the NCGroup and Operation objects are arranged hierarchically. There are actually four independent tree structures: the Geometry view, the MachineMethod view, the MachineTool view, and the ProgramOrder view, which correspond with the four possible views shown in the Operation Navigator in interactive NX.
Any given operation will appear in all four of these views. As the name implies, the four views just provide us with four different ways of looking at the same set of operations. In NX Open, the four view types are described by the four values of the NXOpen.CAM.CAMSetup.View enumeration. An NCGroup object has GetParent and GetMembers functions, so we can navigate up and down each tree. An Operation object has a GetParent function that tells us its parent in each of the four views. There is also a GetRoot function that gives us the root of each view tree.
So, the code to get the root of each view and the first-level members is as follows:
Dim setup As NXOpen.CAM.CAMSetup = workPart.CAMSetup Dim geometryRoot As NXOpen.CAM.NCGroup = setup.GetRoot(NXOpen.CAM.CAMSetup.View.Geometry) Dim methodRoot As NXOpen.CAM.NCGroup = setup.GetRoot(NXOpen.CAM.CAMSetup.View.MachineMethod) Dim machineRoot As NXOpen.CAM.NCGroup = setup.GetRoot(NXOpen.CAM.CAMSetup.View.MachineTool) Dim programRoot As NXOpen.CAM.NCGroup = setup.GetRoot(NXOpen.CAM.CAMSetup.View.ProgramOrder) Dim geometryRootMembers As NXOpen.CAM.CAMObject() = geometryRoot.GetMembers() Dim methodRootMembers As NXOpen.CAM.CAMObject() = methodRoot.GetMembers() Dim machineRootMembers As NXOpen.CAM.CAMObject() = machineRoot.GetMembers() Dim programRootMembers As NXOpen.CAM.CAMObject() = programRoot.GetMembers()
When we create a new “group” object (like a tool), it must be correctly placed in one of these four views, by indicating which group should be its parent. When we create an operation object, it must be correctly placed in all four views, so we need to specify four parents. Further details can be found in the next two sections, which discuss creation of tools and operations.
FYI I'm not sure if this helps, but in 9.0.3 MP2 we made cutmthd_libref available in set_machining_data.tcl.