fuffina13
Aerospace
- Feb 26, 2015
- 1
Hello everyone,
I really could use some help for my issue!
I have to run a Macro.CATScript and every time I do, I get this error!
CNEXT CatScriptErrorMessages - ScriptingERR_1002
Source: CATIAFileSystem
Description: The method GetFile failed
I don't know what to do because I am not an expert in VBA language and I actually don't know how to write a Macro in a correct way!
The one I have is my tutor's and it works fine on his computer!
I attach here the first few lines of my Macro which reads vectors from a file.txt and transforms them in points coordinates.. or at least it should do it!
Language="VBSCRIPT"
Sub CATMain()
' copy data from data.txt
Const ReadTxtFile = "x_profilo_up.txt"
' attenzione il file txt deve essere scritto con le virgole e senza righe vuote
Dim oFile As File
Set oFile = CATIA.FileSystem.GetFile (ReadTxtFile)
Dim oStream As TextStream
Set oStream = oFile.OpenAsTextStream ("ForReading")
Do While Not (oStream.AtEndOfStream)
Dim Line As CATBSTR
Dim xup(201)
For i = 1 To 201
xup(i) = oStream.ReadLine
Next
Loop
oStream.Close
Thanks for anyone's attention and help!
I really could use some help for my issue!
I have to run a Macro.CATScript and every time I do, I get this error!
CNEXT CatScriptErrorMessages - ScriptingERR_1002
Source: CATIAFileSystem
Description: The method GetFile failed
I don't know what to do because I am not an expert in VBA language and I actually don't know how to write a Macro in a correct way!
The one I have is my tutor's and it works fine on his computer!
I attach here the first few lines of my Macro which reads vectors from a file.txt and transforms them in points coordinates.. or at least it should do it!
Language="VBSCRIPT"
Sub CATMain()
' copy data from data.txt
Const ReadTxtFile = "x_profilo_up.txt"
' attenzione il file txt deve essere scritto con le virgole e senza righe vuote
Dim oFile As File
Set oFile = CATIA.FileSystem.GetFile (ReadTxtFile)
Dim oStream As TextStream
Set oStream = oFile.OpenAsTextStream ("ForReading")
Do While Not (oStream.AtEndOfStream)
Dim Line As CATBSTR
Dim xup(201)
For i = 1 To 201
xup(i) = oStream.ReadLine
Next
Loop
oStream.Close
Thanks for anyone's attention and help!