×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Grip Question

Grip Question

Grip Question

(OP)
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:

RE: Grip Question

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

RE: Grip Question

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
http://www.ugs.com

RE: Grip Question

(OP)
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

RE: Grip Question

(OP)
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        

RE: Grip Question

Before the loop, initialize the counter (i=1).

RE: Grip Question

(OP)
thanks
Bob

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources