Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Grip to assign part attr to assy files... 2

Status
Not open for further replies.

Shadowspawn

Aerospace
Sep 23, 2004
259
Howdies,

I need to open a native assy and assign 2 TC attributes (db_part_no & db_part_rev) by parsing the existing native part name/rev (providing for interactively changing the db attr if I don't like what's suggested). This is in preparation of totally crap legacy files for TC.

Essentially, I'd like to:
fully open the assy (in or out of NX)
parse existing part name and part rev into what will be the TC part_no & part_rev
accept the suggestion <or> change as desired
cycle to next part & repeat ...thru the entire assy structure.

Would anyone have something similiar they would be willing to share? ...or get me started?

TIA

Regards,
SS

CAD should pay for itself, shouldn't it?
 
Replies continue below

Recommended for you

Open the assy in Native, export the part number and name to excel, format columns to remove rev and part number.

Use a premade clone file to import the assy into TCE using the part name, number and rev.

 
I've got oodles of parts, and assy's to do as this isn't a 'one shot deal'. Per our Siemens guy, adding the TC attributes to the native file will facilitate automapping of the part names/rev when we import the assys into TC via the cloning functionality. They've been down the road of using the spreadsheet already...

Regards,
SS

CAD should pay for itself, shouldn't it?
 
Sounds like an interesting problem. I may have some time later today to look into it.

What format are your current part names / revisions in? Is there a common delimiter? How many quirky exceptions to the rule(s)? Do you expect to accept the default most of the time? If so, how about we just report what was done via a text file (or the output window) and you can inspect that and revise any individual files as needed; otherwise you will have to baby sit the program and click the OK button twice per part.
 
Cowski,

Theres the rub! On an 'as needed' bases, the plan is to pull legacy parts/assy into the db. Unfortunately, the naming conventions, delimiters, etc are all over the damn place. Some parts only have a descriptive name, not a part number. I/we expect to babysit the program as it goes thru so that's not a big deal...

Regards,
SS

CAD should pay for itself, shouldn't it?
 
For the files that do have a part name and revision, is there a common delimiter or format (eg 12345r1.prt or 12345_a.prt or 12345.01.prt)? If not, what are the most common ones?
 
Cowski,

Unfortunately, there has been no enforcement of the naming convention, and the delimiters can include underscored, dashes, or periods. ...and sometimes a mix!

It's been a while since I've written grip, but I'm willing to take a swing at it and I certainly don't expect the coding to be done for me. :)

Thanks again for the efforts!

Regards,
SS

CAD should pay for itself, shouldn't it?
 
Here's my first stab at it. It is a journal file, it only assigns attributes to the first level components (does not recursively travel down subassemblies) and does not assign anything to the top level assembly (yet).

I thought you would like to play around with this before I went too far in potentially the wrong direction.

Is this like what you had in mind?

 
 http://files.engineering.com/getfile.aspx?folder=501dd975-6bcb-49fb-bf2b-d5c95a0a197f&file=assign_attributes_to_component_part_files.vb
Are you planning on importing your parts via the ug manager clone utility? If so, we can expand this journal to write out the clone files at the same time.
 
OK, attached is a GRIP program which does what you've asked for. Here is what it does:

It first checks to make sure that you actually have a part file open.

It then sets the Displayed part to be the Work part so that it starts at the top of the assembly structure.

It then checks to make sure that the TC attributes have not already been assigned. If either TC attribute has already been assigned to the Assembly file, it skips the assembly and moves to the next step. However, if the TC attributes do not exist, it reads the assembly file name and displays it in a dialog where you can either accept it as is or edit it to what you desire as well as entering a Revision Label. It then assigns the assembly part file the TC attributes using the values entered by the user as their values.

The program then cycles through the entire loaded assembly, including sub-assemblies, counting the number of components and then displaying that as a sort of sanity check.

It then cycles back and starts setting components, one at a time, to be the work part.

Again it checks to make sure that the TC attributes have not already been assigned. If either TC attribute has already been assigned to the Component file, it skips this component and moves to the next one. However, if the TC attributes do not exist, it reads the Component's file name and displays it in a dialog where you can either accept it as is or edit it to what you desire as well as entering a Revision Label. It then assigns the TC Part attributes using the values entered by the user as their values.

It then moves to the next component in the assembly until all component parts have been assigned the TC attributes based on the user's input.

At the end of the program it sets the displayed part back as the work part and then displays a message explaining that NONE of the modified files have been saved and that the user MUST do this manually by selecting the 'Save-All' command.

Anyway, give it shot and see if this meets your needs.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Gents,
Good morning, and apologies for not responding sooner. I was 'out of the office' yesterday... As such, I haven't been able to look at or test either the journal or grip routine, but will do so today and report back. Thanks for the efforts regardless!



Regards,
SS

CAD should pay for itself, shouldn't it?
 
Gents,

I've looked at both....

Cowski: The journal works nice so far... and is heading down the right direction. I will need to recursively hit all the sub assy/components, and the top level as well. In addition, we are planning to use the clone utility, and my guy is currently working w/our Siemens rep to generate a couple of bat files that will generate the clone log, and use that clone log for the import into TC.

John,
This is certainly heading down the right path! I like where it tries to recursively hit all sub-assemblies (sometimes 4 or 5 deep, with common components in a couple of different subassemblies), unfortunately it's giving a run time error at line 103 (setting the work part to the componant part: PARTOP/SET,work,COMPNAM). I haven't had time yet to dig into it yet though... Hopefully, after figuring out the fix for this, I'll be able to finish modifying the routine as needed.


I might add, our naming convention will typically be (depending on which part of the company generated the part):
1234567-rev.prt
1234567-rev_dwg.prt
proj&description-rev.prt
...and the dashes above, can be a 'dash', 'underscore', or 'period'. :-|



Regards,
SS

CAD should pay for itself, shouldn't it?
 
What exactly did the error say? Did it do it immediately on the first component in your file or did it work for a bit and then start to complain? Did you try another assembly file with perhaps different parts with different names?

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
John,

The error states: 'Error 154357 at line 103 in ASSIGN_PART_ATTRIBUTES. Solid modeler failure.' I've tried multiple assemblies w/different part names and continue to get the same error. I created a test assy of empty part files (no models) several layers deep, w/the same component in different parts all w/in the same top level assy. There were no errors, except for a different erros telling me a part wasn't opened (no biggie). In addition, I re-visited several of the assys where I got the error and interogated the models... examined geometry, part clean up, part playback... and I can't find anything wrong w/the files themselves. All of the assys are 'in date' and NX 6.0.3.6 did not try to update anything. I'm not sure where to go from here.

Unfortunately, I'll be out of the office all next week so it will be a week before I can revisit this thread. Rest assured though, I will be back. Thanks again for your time...

Regards,
SS

CAD should pay for itself, shouldn't it?
 
Cowsky,

It seems to run fine (no buggies) but I did notice a couple of things...
1) If the same part is in multiple sub-assys, it re-writes the db_attr again. Is there a way to easily check for the attribute and display it if it exist (versus trying to parse it again from the convoluted pos part name)? ...which brings us to
2)It appears that the first instance of a delimiter it encounters is used to separate the name from the rev. Considering the way these files are named, using the last instance of a delimiter would be better (less typing and chance of error on the users part).

As I'm sure you've read in my reply to John, I'll be out of the office all next week and will be unable to test anything until I get back. However, if either you or John have any questions, please feel free to post em cause I will be reading this thread...

Thanks again...

Regards,
SS

CAD should pay for itself, shouldn't it?
 
Actually... not quite. I was on vaca, and when I got back I got hammered w/production stuff and TC implementation... It seems that although I can cold deploy the package to the test db, it fails when I attempt to deploy to the prod db. GTAC has yet to provide any real assistance... but thats another story. In the meantime, I've been (out of necessity) recreating / modifying our dwgs & patterns, and seed parts, updating pallets, etc...

I've floated your journal to the gents responsible for migrating the initial data and haven't heard back from them. I'll hit them up and find out what I can.

Thanks much for poking me, and I'll respond back as soon as I can. :)

Regards,
SS

CAD should pay for itself, shouldn't it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor