Hi @fraserscott,
Looking at the full code, you would need to strip out some more strings from the value. Here are 2 quick examples. The 2nd one uses the Regex import to extract the number from the string, and is probably the better way to go.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
oValue = Leg_Choice 'get value of parameter
oValue = Replace(oValue, "Marine", "") 'remove Marine if present
oValue = Replace(oValue, "Atlantic", "") 'remove Atlantic if present
oValue = Replace(oValue, "(SAA)", "") 'remove (SAA) if present
oValue = Trim(oValue) 'remove spaces
oCompString = "Legs Assembly" 'string to look for
'look at all components
For Each oComp In ThisAssembly.Components
'look at only components containg the string we're looking for
If oComp.Name.Contains(oCompString) Then
'set model state
Component.ActiveModelState(oComp.Name) = oType
'set height
Leg_Height = oValue
End If
Next
Imports System.Text.RegularExpressions
oValue = Leg_Choice 'get value of parameter
oValue = Integer.Parse(Regex.Replace(Leg_Choice, "[^\d]", "")) 'extract number
oCompString = "Legs Assembly" 'string to look for
'look at all components
For Each oComp In ThisAssembly.Components
'look at only components containg the string we're looking for
If oComp.Name.Contains(oCompString) Then
'set model state
Component.ActiveModelState(oComp.Name) = oType
'set height
Leg_Height = oValue
End If
Next