Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grip: Array subscript / variable length object list

Status
Not open for further replies.

Shadowspawn

Aerospace
Sep 23, 2004
259
Hey folks,
I'm back in need of some more help... I'm currently writing a program that adds std notes to new drawings. I have the program set up where the user answers a series of questions that determines the type of dwg being created, and thus loads the appropriate notes. The note file names are in seperate object lists with varying number of notes, with the number of notes being represented by a variable:
...
x=x+1
IF/resp==5, tfn=dir+fname(x)+'.txt'
...
In the above snippet, the object list to call is 'fname' and as I loop through, the individual note to call is represented by 'x'.
Depending on the type of dwg, the number of notes varies. My problem is that I'm getting an error message that 'A subscript of an array is out of range' when I loop past the number of notes in the object array. Any ideas how I can solve this little dilema, without making all the object arrays the same length, padded with a 'fake' note to signal a jump out of the loop (or something similiar)?
Any suggestions would be appreciated, of course.

SS
 
Replies continue below

Recommended for you

Are you reading the whole file for different note types, with each file being different lengths?

OR

Are you reading certain lines from a file to form your notes?



"Wildfires are dangerous, hard to control, and economically catastrophic."
"Fixed in the next release" should replace "Product First" as the PTC slogan.

Ben Loosli
CAD/CAM System Analyst
Ingersoll-Rand
 
Ben,
Each note file is in a seperate text file, with each being different lengths of course. I had a thought last night (rare occurance mind you...) that I could compare 'x' to the 'known' total number of notes for a particular type, then jump out if x reaches that total.
...
IF/resp==5 AND x==3,JUMP/done:
ELSEIF/resp==6 AND x==27,JUMP/done:
ELSEIF/...
...
I haven't had the chance to code/debug it yet, so if you can think of a better way then let me know. I probably won't get a chance to play with the code until this afternoon, as I still have my normal design duties to complete first before the let me play with code.

SS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor