Showing results for 
Search instead for 
Do you mean 
Reply

How to export name description of components to excel?

Hello,

 

I am wondering if somebody can tell me how to export the name description of each component in the assembly to excel in VB.NET? Thank you.

8 REPLIES

Re: How to export name description of components to excel?

by "name description" - what do you mean?

Are the parts in Teamcenter?

Are these attribuutes?

Is it the file name itself?

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: How to export name description of components to excel?

The parts are in TeamCenter, and  no it is not the file itself. I am talking about the the description of the parts in the assembly navigator, under the "Name" column. I understand that not everybody  is going to have the same set up as I do in NX when it comes to the navigator, but I am not talking about the model number, rather the description of the parts itself. I hope that is clear enough.

Re: How to export name description of components to excel?

OK, then these should map to attributes in the parts

Look at DB_PART_NAME and DB_PART_DESC to see what matches the column you want

(i.e. look in the assembly navigator, pick one of the components.  note its description.  Then make that the displayed part, and use File -> Properies -> Attribute tab to see which attributes value matches the text you want - depending on TC customization they may not be exactly what I list above)

 

Aside:
Note (in the assembly navigator) you can right-click -> "expand all", then right-click -> "Export to Spreadsheet", which should create a table in Excel with ALL the data shown in the ANT.

 

Save this somewhere, then exit Excel, then open in an extenral Excel session to edit (the "Export to Spreadsheet" instance of Excel "locks" NX until you exit that Excel session)

 

Could get you what you want with a lot less programming :-)

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: How to export name description of components to excel?

[ Edited ]

Thanks for your reply. So I have a journal I have beenw orking on, and I have been experiementing and trying to get the DB_PART_DESC or DB_PART_NAME exported, but I am running into some issues. In my journal I am processing whole assemblies, not individual model parts. If take a component and make it my displayed part, it will list the attributes above, which is exactly what I want. However, if I load an entire assembly with the top level part as the work part, the above attributes are not theer anymore, and I can no longer export the values in those attributes.

 

I have to be able to process whole assemblies, not individual components. Is there a way to export these attributes even when my top level part is made the work part?

 

This is the particular line of code I have been using:

 

objExcel.cells(row, 2).Value = c.RootComponent.GetStringAttribute("DB_PART_DESC")

Re: How to export name description of components to excel?

You need to get the attributes from every component, something like this:

 

                Component[] components = c.RootComponent.GetChildren();

                
                foreach (Component childComponent in componenten)
                {
childComponent.GetStringAttribute("DB_PART_DESC")
}

This is c#, vb will be something like "Dim components as Component[] " .... 

 

W10 NX11.0.1

Re: How to export name description of components to excel?

Hi,

Have you had a look at the sample program posted in the NXJournaling forum? You might want to remove the portion of code that creates images for each of the components, but the basic  structure and syntax of cycling through each of the child  components will be useful to you.

 

http://www.nxjournaling.com/content/export-assembly-excel-pictures-0

 

Regards, 

Geoff Donohoo

NX10.0.3.5 & TC 10.1.4.2
Dell T3600 32Gb Ram, Nvidia Quadro 4000
Windows 7

Re: How to export name description of components to excel?

Thanks for the link, I was able to use the code as reference to finally output the children names. I did however want to try and indent the children under all of the parents in excel, just like it was done in the code you provided. However i am having t rouble making that happen, or even understand exactly how it was done. Can you guys provide some code to get me started?

Re: How to export name description of components to excel?

If you run the journal posted here:

http://nxjournaling.com/content/creating-subroutine-process-all-components-assembly

 

It will output an indented list to the NX information window. It uses recursion to step through the assembly structure, increasing the indent level each time a subassembly is encountered. Perhaps you could use a similar strategy in your Excel file.