Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Populating Part Tree from Excel File

Status
Not open for further replies.

CR98

Mechanical
Jul 15, 2018
5
Hello,

I'm currently trying to populate a blank part tree, with the information coming from an excel sheet that lists indenture numbers, part number, part name, etc. I'm doing this by writing 2 loops of code in a journal (using VBA) to create either an assembly component or a part component based on indenture, then the 2nd will go back and organize the parts (make children of parent part/assembly). Currently, there's 2 issues I've run into, hoping to get some feedback.

1. Multiple parts with same part number: I need to make multiple parts with same number (i.e. 4 washers) however, NX will create one then throw the error "file already exists" I imagine an error handler of " if file exists, copy/paste/unpack would fix this, but without it being a recordable action, I'm at a loss for the syntax.

2. Drag/Drop components: I have the logic for how to find a components parent and recorded a journal of drag/drop action, however I cannot use a string to reference a component name (i.e. component name = excel.workbook.worksheet.range.value) is there a way to convert this string to a name NX can read?

I can post my code in the future if that helps, but these issues seemed independent of the code.
Using NX10, without TeamCenter

Thanks
 
Replies continue below

Recommended for you

Are you mean to
create an empty assembly part
(structure only)

If yes I'll track your post
because that very interesting.

In the past I tried to do that in relative
to stp part importing.

But I found no way to start.

Thank you.
And good lack.
 
thread561-350926

The thread above has some code that will create an assembly file from text file input. You might be able to re-work it to use Excel input or it may, at least, be able to answer your questions. The full code is in the dropbox link further down the thread; the first code listing is fairly rudimentary.

www.nxjournaling.com
 
Ehaviv

The end goal would be a part tree of blank components, so if a single part needed to be redrawn it could be done so while still showing what assembly, sub-assembly, etc. it's apart of.



Cowski

Thanks for the code, don't know how I missed that thread scouring the internet about this. I'll try to make sense of it today and see if I can adapt it to Excel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor