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 Question

Status
Not open for further replies.

smitty239

Automotive
Jan 4, 2007
60
Hi Everyone
I use the below in a program to cycle thru components in an assembly and write the file names to a text file. My problem is a do loop is only good for 1000 labels and many of my assemblies are well over that. Can someone tell me how to write all the names of every component and not miss any ? This may be easy for some of you but I am a hacker at the best of times and any help would be appreciated.
Thanks

Bob Smith


CREATE/TXT, 2
inexte/all
mask/63



DO/D900:,i,1,900
comps(i) = nexte/ifend,a10:
names(i) = &name(comps(i))
print/ names(i)
WRITE/2, names(i)

D900:
 
Replies continue below

Recommended for you

If you use sub-assemblies, check for the file being an assembly and then write them out separately. You don't have over 1000 components in any one assembly, do you?
You could also check if the name was already written to the file so you only get unique file names.



"Wildfires are dangerous, hard to control, and economically catastrophic."

Ben Loosli
Sr IS Technologist
L-3 Communications
 
Why use a loop at all? You want to run until you get to the last component, right? You've already got the solution (well, almost). Just change your code to something like this:

CREATE/TXT, 2
inexte/all
mask/63
L001:
comps(i) = nexte/ifend,END1:
names(i) = &name(comps(i))
print/ names(i)
WRITE/2, names(i)
JUMP/L001:
END1:

This will continue to 'loop' until you reach the last component and then it will jump to END1: and you're out of the 'loop'.


John R. Baker, P.E.
Product 'Evangelist'
NX Product Line
UGS Corp
Cypress, CA
 
Thanks Guy's
I knew someone would give me the correct path to follow. Like I said I'm more of a hacker than a programmer I appreciate it.
Bob Smith
 
I spoke to soon guy's
I changed the program below is what i changed it to with the declarations

STRING/names(3000,100) $$ part names used in loop
ENTITY/comps(3000) $$ number of components
NUMBER/i $$ used in loop



CREATE/TXT, 2
inexte/all
mask/63 $$comps only



D90: $$loop for all comp names
comps(i) = nexte/ifend,a9:
names(i) = &name(comps(i))
print/ names(i)
WRITE/2, names(i) $$write names to file

JUMP/D90:
a9:
when i run the program i get the error "subscript of an array is out of range" what did I do wrong here? again any help would be greatly appreciated
 
Before the loop, initialize the counter (i=1).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor