Dim varstring As String * 6
'fixed length string needed for mid(ansistr,1,3) why 6? 'coz of UNICODE format
Dim start_str As String * 6
Dim wholevarstring As String 'later
will redim it
oldstartpoz = startpoz ; ansistr = "" ' init
values
Open filename For Binary
Access Read Lock Read As #1 ' or use FreeFile(0)
for #1 ....
how_deep = 1
Do
Get #1, how_deep, start_str
ansistr = UnicodeToAnsi(start_str)
how_deep = how_deep + 1
Seek #1, how_deep
Loop While (Mid(ansistr, 1, 3) <> "BON")
And (how_deep < 800)' or 600
If how_deep > 800 Then
Msgbox "Couldn't
find Beginning of NOTES!!"
Close #1
Exit Sub
End If
startpoz = how_deep - 1
oldstartpoz = startpoz
Seek #1, startpoz
Do
Get #1, startpoz, varstring
ansistr = UnicodeToAnsi(varstring)
startpoz = startpoz + 1
Seek #1, startpoz
Loop While (Mid(ansistr, 1, 3) <> "BON")
And (startpoz < oldstartpoz + 120) <- just
in the case we can't find the EONOTES
If startpoz >= oldstartpoz + 120 Then
' some message 120 lenght of our notes
Msgbox "Couldn't
find End Of NOTES!!"
Close #1
Exit Sub
End If
wholevarstring = String(startpoz - oldstartpoz, " ")
' redim whole string to the size of notes
Seek #1, oldstartpoz
Get #1, oldstartpoz, wholevarstring
ansistr = UnicodeToAnsi(wholevarstring)
ansistr = Mid(ansistr, 1, Len(ansistr) - 1)
at this point the ansistr contain complete NOTES, now we can use
some VB's String functions: Split, InStr,
InRevStr, Mid, Left,
Right ....to get desired values.
Where we would need something like the above? Let say we want to scale some
template 3DM file and user want to insert it into Rhino with a predetermined
size, so we'll need to know template size and so on ...
Perhaps, one will have some free time and make the above shorter and as a function
...