Here is how to remove unit identifier for inches [ " ] from a string. Use the string function replace.
1. Populate Description by code
'Trigering Criteria, Local Parameters are only used to trigger the rule to run.
a = Width
b = Height
c = Thk
'Replaces " with Empty String.
Dim width As String = iProperties.Value("Custom", "Width").ToString.Replace("""", "")
Dim height As String = iProperties.Value("Custom", "Height").ToString.Replace("""", "")
Dim thk As String = iProperties.Value("Custom", "Thk").ToString.Replace("""", "")
'Set Description iproperty.
iProperties.Value("Project", "Description") = "L " & width & " x " & height & " x " & thk & " x "
Result:
2. Populate Description by expression:
= L <Width> X <Height> X <Thk>
'Trigering Criteria, Local Parameters are only used to trigger the rule to run.
a = Width
b = Height
c = Thk
'Replaces " with Empty String.
iProperties.Value("Custom", "Width") = iProperties.Value("Custom", "Width").ToString.Replace("""", "")
iProperties.Value("Custom", "Height") = iProperties.Value("Custom", "Height").ToString.Replace("""", "")
iProperties.Value("Custom", "Thk") = iProperties.Value("Custom", "Thk").ToString.Replace("""", "")
Triggering this rule was a lot trickier than I had imagined.
What did Work:
It is necessary to have the local parameters in the rule in order for the rule to be automatically triggered on parameter change.
What didn't work:
- Simply setting the rule to run on the event trigger of change of iproperties did not work. Changing the parameter and exporting the parameter is not considered a change to iproperty it seems.
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan