I am fairly new to Rhino Scripts even though I am used to programming. I have been facing something I thought easier to fix.
Basically I have a txt file with only numbers and I would like to extract the numbers I have within this text file and save them into different variables to use later on within the same script.
for example if I open the text file I can see:
1 2 3 4 5 6
I want to read this text file (already done thanks to this forum), and save this into a matrix, let’s say “A”, and use these values by simply calling A(1), A(2) etc.
but apparently there is a problem with the variables. Here is the example of the script:
Dim objFSO, objFile, strFileName, strLine
Const ForReading = 1
strFileName = Rhino.OpenFileName(“Open”, “Text Files (.txt)|.txt||”)
If IsNull(strFileName) Then Exit Sub
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objFile = objFSO.OpenTextFile(strFileName, ForReading)
While Not objFile.AtEndOfStream
strLine = objFile.ReadLine
Set objFSO = Nothing
In this way I open the text file and save the information within strLine.
after this I need to do something like:
and so on with all the elements I have.
but the error I keep getting is:
Type mismatch: ‘A’
Can you please help me on this?
Thank you in advance