Solved! Go to Solution.
Solved by rossano_praderi. Go to Solution.
Hi, this is a basic example for change the parameter name.
Dim oDoc as PartDocument oDoc = ThisApplication.ActiveDocument Dim oFeature As PartFeature For Each oFeature In oDoc.ComponentDefinition.Features If oFeature.Name = "iFeature15:1" Then 'Old name oFeature.Name = "test" 'New name End If Next
Bregs
Rossano Praderi
Hi Ben, yes it is.
I'm wrote "Features" instead of "Parameters", sorry.
This the correct code.
Dim oDoc as PartDocument oDoc = ThisApplication.ActiveDocument Dim oParameter As Parameter For Each oParameter In oDoc.ComponentDefinition.Parameters If oParameter.Name = "d0" Then oParameter.Name = "test" End If Next
Bregs
Rossano Praderi
How Can you set a more general search in the name, as in..
oParameter.Name <> "My_Searching_Parameter" then
oParameter.Name = My_Parameter
Hi, the following code is the simplest solution (converted from my original code)
Sub CheckAndChange(oDoc as PartDocument, oParameter As Parameter, NameToFind as string, NameToAssign as string) For Each oParameter In oDoc.ComponentDefinition.Parameters If oParameter.Name = nametofind Then oParameter.Name = nametoassign End If Next End Sub
If you would like a more complex, but as simple implementation, solution which check a string with given "searching_parameters", the following linked function can give you a basic idea on where you can start.
https://dotnetfiddle.net/YOo5Rf
Bregs
Rossano Praderi
Yes Thanks, But...
I what i meant is since the name to find can be whatever... because i want the same parameter to change between 40 different parameters names, i wont which name it will be currently on.
So to set it to these 40 different names i just wan to check if "its not equal to" to that name then assign it that name.
I cant use the <> operator somehow...
is there another operator to say is not equal to? i tried searching online already...
thank you for you prompt response
You should open a new thread and give to the community an example of what you would like to obtain.
Your question can have many solutions and, may be, your first step is not to find the right operator.