VBA Macro(UG) to rename each Operation with its Tool name
VBA Macro(UG) to rename each Operation with its Tool name
(OP)
Hello Team,
Can anyone please suggest the macro which will run through all operation list and rename it with Tool Name.
Please suggest
Thanks
Rishi
Can anyone please suggest the macro which will run through all operation list and rename it with Tool Name.
Please suggest
Thanks
Rishi





RE: VBA Macro(UG) to rename each Operation with its Tool name
Basically, you need to cycle through each operation in the Operation Navigator, get the name of its tool parent, and then rename the operation.
There are some samples of cycling through operations and renaming in your installation.
Go to UGOPEN\SampleNXOpenApplications\.NET\CAM and look for programs with "CycleAll" in the name.
Mark Rief
NX CAM Customer Success
Siemens PLM Software
RE: VBA Macro(UG) to rename each Operation with its Tool name
VBA -- is not used much these days, and has never been used in Siemens products
Macro -- an older (and deprecated) way of recording user actions, superseded by journals
UG -- no longer exists; it has been called NX for the last decade or so
RE: VBA Macro(UG) to rename each Operation with its Tool name
I am able to loop through each operation....only problem I having is with getting the Tool name.
Few lines of codes will be of great help as how to get the tool name when its looping through each operation.
Many Thanks
RE: VBA Macro(UG) to rename each Operation with its Tool name
CODE -->
Graham Inchley, Systems Developer, Sandvik Coromant. www.sandvik.com
HP EliteBook 8760w, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP4 64bit
Testing: NX9.0.2.5
RE: VBA Macro(UG) to rename each Operation with its Tool name
Feel free to post your final program when you get it all working.
I am always looking for more good examples.
Mark Rief
NX CAM Customer Success
Siemens PLM Software
RE: VBA Macro(UG) to rename each Operation with its Tool name
Thanks for your response,
I tried to put your code but its showing some messages which I have attached. Please suggest
MACHINE_TOOL IS NOT A MEMBER OF 'NXOpen.CAM.CAMSetup.View'.
'name is not a member of String
Character is not valid
Thanks
Rishi
RE: VBA Macro(UG) to rename each Operation with its Tool name
Any suggestion...
Thanks
Rishi Raj
RE: VBA Macro(UG) to rename each Operation with its Tool name
GANESH KOTHAKOTA
CAD/CAM LEAD
NX8.5, Vericut7.3.1
TECHMAHINDRA Inc
RE: VBA Macro(UG) to rename each Operation with its Tool name
If you look in the documentation for NXOpen.CAM.CAMSetup.View you'll find that the machine member is called MachineTool in C#, VB and C++.
Ganesh is right though, post some of you own code and it'll be much easier for us to help.
Graham Inchley, Systems Developer, Sandvik Coromant. www.sandvik.com
HP EliteBook 8760w, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP4 64bit
Testing: NX9.0.2.5
RE: VBA Macro(UG) to rename each Operation with its Tool name
Sorry for late response...
Here my code which I am using for looping through each operation
Dim counter As Integer = 101
For Each Op As String In Opnames
theUfSession.Ui.SetStatus("Renaming Operation:" & OP)
Dim operation As CAM.Operation
operation = CType(WorkPart.CAMSetup.CAMOperationCollection.FindObject(Op), CAM.Operation)
operation.SetName(Tool Name & counter) ' Tool Name ( Here I need the Machine tool name to be added)
counter += 1
Next
Many Thanks for all your help..
RE: VBA Macro(UG) to rename each Operation with its Tool name
CODE -->
Dim counter As Integer = 101 For Each Op As String In Opnames theUfSession.Ui.SetStatus("Renaming Operation:" & OP) Dim operation As CAM.Operation operation = CType(WorkPart.CAMSetup.CAMOperationCollection.FindObject(Op), CAM.Operation) Dim toolName As String toolName = operation.GetParent(CAMSetup.View.MachineTool) operation.SetName(toolName & counter) counter += 1 NextGraham Inchley, Systems Developer, Sandvik Coromant. www.sandvik.com
HP EliteBook 8760w, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP4 64bit
Testing: NX9.0.2.5
RE: VBA Macro(UG) to rename each Operation with its Tool name
Thanks for quick reply...I tried to put your code in between but its shows the below message for below line
toolName = operation.GetParent(CAMSetup.View.MachineTool)
Error message - Value of type NXOpen.CAM.NCGroup cannot be coverted to string
Please suggest.
Thanks
Rishi
RE: VBA Macro(UG) to rename each Operation with its Tool name
CODE -->
Dim counter As Integer = 101 For Each Op As String In Opnames theUfSession.Ui.SetStatus("Renaming Operation:" & OP) Dim operation As CAM.Operation operation = CType(WorkPart.CAMSetup.CAMOperationCollection.FindObject(Op), CAM.Operation) Dim toolGroup As NCGroup Dim toolName As String toolGroup = operation.GetParent(CAMSetup.View.MachineTool) toolName = toolGroup.Name operation.SetName(toolName & counter) counter += 1 NextGraham Inchley, Systems Developer, Sandvik Coromant. www.sandvik.com
HP EliteBook 8760w, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP4 64bit
Testing: NX9.0.2.5
RE: VBA Macro(UG) to rename each Operation with its Tool name
It worked....many thanks!!