Ilogic: Replacing characters with numbers in an array

Ilogic: Replacing characters with numbers in an array

Anonymous
Not applicable
476 Views
0 Replies
Message 1 of 1

Ilogic: Replacing characters with numbers in an array

Anonymous
Not applicable

Hello, I am totally new to this forum. What I am trying to do is use the name of the file to drive the parameters using Ilogic. I have a part number (.ipt) file with the file name 9999-ABCDEF. I used the following code to isolate each extension and place them in an array. I've also defined the values that each of the extension letters tie to, and have placed their variants into arrays as well. For example, the first extension is letter "A" which should drive the part length to be 12". If the second extension is "B" which should drive the part height should be 3".

My plan was to have each letter of the extension convert to a number that I then used as my reference point for pulling the dimension value from the following arrays. ("A" would convert to 0 and the code would search LengthVariants(0) to get 12".

However I cannot figure out the way to convert the letter codes from my first array into numbers that I can use as index points for my secondary arrays. How can I replace characters with numbers in an array?

'FileName
Name=ThisDoc.FileName(False)

'Dividing Symbol
Delimiter = InStr (Name,"-")

'The Count of Extensions past the Delimiter
ExtensionLength = Len(Name)-Delimiter

'Setting Array That Holds The Characters of all the extensions
Dim Extensions(ExtensionLength-1) As String

'The Next Count/While Loop Sets the Specific Values in the array based off the extension E(0) will be the dirst extension, E(1) the second, etc.
'TEST KEY'
'Extensions(0)=LengthVariants Extension Letter
'Extensions(1)=HeightVariants Extension Letter
'Extensions(2)=FlangeVariants Extension Letter
'Extensions(3)=FirstCutoutVariants Extension Letter
'Extensions(4)=StrandCentersVariants Extension Letter
'Extensions(5)=StrandQTYVariants Extension Letter

Count = 0

While Count < ExtensionLength

Extensions(Count)=Left(Right(Name,Len(Name)-Delimiter-Count),1)

Count = Count + 1

End While
'End of loop to seperate and assign each extension

'Setting Array That Holds all the possible values of all the first extension

LengthVariants = New Double(){12,24,36,48,60,72,84,96,108,120}
HeightVariants = New Double(){2,3,4,5,6,6.5,7,8,9,10}
FlangeVariants = New Double(){1,1.5,2,2.5,3}
FirstCutoutVariants = New Double(){6,9,12,15,18,21,24,27,30}
StrandCentersVariants = New Double(){6,9,12,15,18,21,24,27,30}
StrandQTY = New Double(){1,2,3,4,5,6}

'Setting Array to Convert Letter Code into index reference point for above arrays

0 Likes
477 Views
0 Replies
Replies (0)