Find MCS used for CAM Operation in NX Open
Find MCS used for CAM Operation in NX Open
(OP)
Can anyone shed any light on how to get the name of the MCS used in an operation in NX Open (vb.net)??
I tried
theUFsession.Param.AskTagValue(myoperation.tag, 59, tvalue)
which fills a tag value of what I thought whas the MCS. I then just thought I would need to extract the name using
theUFsession.Obj.Askname(tvalue,strMCSname)
but this gives an error.
Any clues anyone? Many Thanks.
I tried
theUFsession.Param.AskTagValue(myoperation.tag, 59, tvalue)
which fills a tag value of what I thought whas the MCS. I then just thought I would need to extract the name using
theUFsession.Obj.Askname(tvalue,strMCSname)
but this gives an error.
Any clues anyone? Many Thanks.





RE: Find MCS used for CAM Operation in NX Open
I think what you are looking for is the geometry group in the Operation Navigator that has that CSYS selected for the MCS - correct?
I don't have an example, but I think you need to climb up the geometry parent tree from the operation, and find all the orient groups in the heirarchy. Then, look in each one to see if the CSYS you are looking for is selected as MCS.
Mark Rief
NX CAM Customer Success
Siemens PLM Software
RE: Find MCS used for CAM Operation in NX Open
I knife and forked something together that does the job, albeit a bit clunky if you ask me! Here is some code for anybody needing it...You could probably use a While Loop rather than some IF statements to work your way up the geometry tree.
Dim sOpName as string = "NAME_OF_YOUR_OPERATION"
Dim operation As CAM.Operation
operation = CType(workPart.CAMSetup.CAMOperationCollection.FindObject(sOpName), CAM.Operation)
'search up the geometry tree to find the mcs
Dim strMCSname As String = ""
Dim MCStag As New Tag
Dim grp1 As CAM.NCGroup = operation.GetParent(CAM.CAMSetup.View.Geometry)
Dim camObject1 As CAM.CAMObject = NXOpen.Utilities.NXObjectManager.Get(grp1.Tag)
If TypeOf camObject1 Is CAM.OrientGeometry Then
strMCSname = grp1.Name
MCStag = grp1.Tag
Else
Dim grp2 As CAM.NCGroup = grp1.GetParent()
Dim camObject2 As CAM.CAMObject = NXOpen.Utilities.NXObjectManager.Get(grp2.Tag)
If TypeOf camObject2 Is CAM.OrientGeometry Then
strMCSname = grp2.Name
MCStag = grp2.Tag
Else
Dim grp3 As CAM.NCGroup = grp2.GetParent()
Dim camObject3 As CAM.CAMObject = NXOpen.Utilities.NXObjectManager.Get(grp3.Tag)
If TypeOf camObject3 Is CAM.OrientGeometry Then
strMCSname = grp3.Name
MCStag = grp3.Tag
Else
MsgBox("CANT FIND MCS FOR OP:" & sOpName)
End If
End If
End If
MsgBox("MCS=" & strMCSname & " tag=" & MCStag.ToString)