kfraysur
Bioengineer
- Feb 4, 2010
- 42
Cowski and others have helped me in the past to create a journal that would locate and edit the names of multiple expressions in a given part. I would like to do something similar with expression values. Basically I want the journal to locate all expressions with a specified value, then change all said expressions to a different specified value.
The two highlighted lines are where I am having trouble. I want to look for the value of each expression and am unsure of the syntax. Any help would be appreciated.
Code:
'This section looks for the "NAME' Expression and changes it to
'"NAME_REMIX[i]" with i being the counter established above
' The following pattern is set to look for the phrase "NAME'" in the expressions list,
' followed by a single apostrophe ('),
' followed by 1 or more digits (\d+),
' followed by 0 or more characters (\.*)
[b][highlight #FCE94F]Dim DNExChange as New RegEx("NAME'\d+\.*")[/highlight][/b]
' sets up a for loop that will check all the expressions in "myExpressionsDNExChange
For Each myExpChange as Expression in myExpressionsDNEx
' if the expression in question matches the "NAME'" pattern set above, then
[highlight #FCE94F][b]if DNExChange.IsMatch(myExpChange.Name) then[/b][/highlight]
' defines a new expression "NAME_REMIX[#]" to replace the NAME'[#] expression,
' but with a number we can account for
Dim expression1 As Expression = CType(workPart.Expressions.FindObject(myExpChange.Name), Expression)
workPart.Expressions.Rename(expression1, "DPF_NAME_REMIX" & i)
end if
Next
The two highlighted lines are where I am having trouble. I want to look for the value of each expression and am unsure of the syntax. Any help would be appreciated.