please help!!! {reading .prt files}

agalmari
11-15-2004, 04:20 AM
hi all.
i'm trying to read a .prt file (draw of unigraphics) as an txt file.
i'm looking for the value of a var called fijacion_uy
(the value is 10 and it appear: .....fijacion_uy=10....)

if i open and save it whith the notepad, i can read it from code.
but, if i create a copy changing the extension to txt, i canīt!!

what can i do???

thanks.
i really nead to solve this problem!

agustin

pd_1: the file i use is attach
pd_2: the code i use is this:


******************************
Dim texto as string

Dim ts As New FileSystemObject
ts.CopyFile "C:\aaa.prt", "C:\aaa.txt", True

Dim file As TextStream
Set file = ts.OpenTextFile("C:\aaa.txt", ForReading, False)

Do While Not file.AtEndOfStream
texto = file.ReadLine
If InStr(1, texto, "fijacion_uy") > 0 Then
MsgBox texto & " " & InStr(1, "fijacion_uy", texto)
End If
Loop

file.Close

******************************************

gravity7
11-15-2004, 07:47 AM
hi all.
i'm trying to read a .prt file (draw of unigraphics) as an txt file.
i'm looking for the value of a var called fijacion_uy
(the value is 10 and it appear: .....fijacion_uy=10....)

if i open and save it whith the notepad, i can read it from code.
but, if i create a copy changing the extension to txt, i canīt!!

what can i do???

thanks.
i really nead to solve this problem!

agustin

pd_1: the file i use is attach
pd_2: the code i use is this:


******************************
Dim texto as string

Dim ts As New FileSystemObject
ts.CopyFile "C:\aaa.prt", "C:\aaa.txt", True

Dim file As TextStream
Set file = ts.OpenTextFile("C:\aaa.txt", ForReading, False)

Do While Not file.AtEndOfStream
texto = file.ReadLine
If InStr(1, texto, "fijacion_uy") > 0 Then
MsgBox texto & " " & InStr(1, "fijacion_uy", texto)
End If
Loop

file.Close

******************************************


Instead of using VB would you be interested in using GRIP to perform this search? I used Unigraphics versions 14 - MX and was into lots of GRIP programming. I only mention this since GRIP is the native scripting language for Unigraphics and it may handle your part files easier than VB. I"ll have to download and test the part file from home as the firewall here at work is blocking me from getting it :(

loquin
11-15-2004, 08:11 AM
IF you want to use VB, you will need to use VB's native file I/O techniques, and NOT fso. fso (FileSystemObjects) does not support non-text I/O, and upon looking at the file, this is not a text file. There are LOTS of non-printable characters in the file.

You will need to process the file as Binary. Take a look at the *** for more information.

agalmari
11-15-2004, 08:34 AM
thanks

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum