Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 6th, 2003, 05:48 PM
lucklessproggie lucklessproggie is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Germany
Posts: 7 lucklessproggie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Reading a cross linked peculiar file into the Program

Hallo All!

I have to develop a Visual basic program that will read in a file of the following format

#1=DIRECTION('',(0.E0,-1.E0,0.E0));
#2=VECTOR('',#1,1.E1);
#3=CARTESIAN_POINT('',(0.E0,0.E0,0.E0));

For those who dont know, its a STEP file, used as a Data Exchange format. The Problem is that most of these Handles use references to each other. For example VECTOR refers to #1 which is DIRECTION. The flow of referencing being upwards ie #2 refers to #1 and #4 to #2 and so on.

I am stymied, the file is Flat in nature, where ';' may be taken as the delimiter. Another thing, the whole file is not more than 300 lines.

What would be the best strategy to deal with this kind of situation? How can it be resolved? Any help would be greatly appreciated!

Thanks
Pete

Reply With Quote
  #2  
Old December 6th, 2003, 10:25 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,176 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 42 m 4 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
see if this helps, if it's just a plain text file, then it shouldn't be too hard

http://forums.devshed.com/t103230/s.html
__________________
Fisherman

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein

Reply With Quote
  #3  
Old December 7th, 2003, 06:57 AM
lucklessproggie lucklessproggie is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Germany
Posts: 7 lucklessproggie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
changing the delimiter in input #filenumber

Thanks fisherman!

The problem I am facing is that the delimiter in my case is a Semicolon. I wonder if there is a way to modify the code given to reflect the new delimiter, since there are a lot of commas in the file, eg

#65=B_SPLINE_SURFACE_WITH_KNOTS('',1,1,((#61,#62),(#63,#64)),.UNSPECIFIED.,.U.,
.U.,.F.,(2,2),(2,2),(-2.E-1,1.02E1),(-1.02E1,2.E-1),.UNSPECIFIED.);

So stumped again!

Pete

Reply With Quote
  #4  
Old December 7th, 2003, 11:18 AM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,176 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 42 m 4 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
ok, try this - instead of reading the line of text into individual variables - read a whole line of text into one variable, then use the split() function to separate that line of text based on your delimiter, into an array variable - like so

Code:
Private Sub Form_Load()
Dim strLine As String
Dim strArray() As String
Dim i As Integer

Open App.Path & "\MyText.txt" For Input As #1
Do Until EOF(1)
   strLine = Input(LOF(1), #1)
Loop
Close #1
strArray = Split(strLine, ",")
For i = 0 To UBound(strArray)
    MsgBox strArray(i)
Next i
End Sub


Try using that code - establish a file in your directory that correlates to the name in the open statement - You can change your delimiter in the split function - it can be any recognized character.

good luck

Reply With Quote
  #5  
Old December 7th, 2003, 01:51 PM
lucklessproggie lucklessproggie is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Germany
Posts: 7 lucklessproggie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
excellent man! Thanks, works like a charm.. i was using another statement
Line Input #1, but this works better, since the semicolons have been stripped off without extra code! Thanks mate!

Reply With Quote
  #6  
Old December 7th, 2003, 03:20 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,176 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 42 m 4 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
glad I could be of service

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Reading a cross linked peculiar file into the Program


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway