Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Using excel commands within a NX macro

Status
Not open for further replies.

someonedflr

Automotive
Jan 14, 2014
40
Hello everyone

I stepped into a problem while trying to automate a task (I'm pretty novice about NX customization, just starting with simple examples and following the Help guides). I'll try to be as clear as possible:

I need to take some information from the PMI report spreadsheet and place it into a table.

Problem 1: It seems that journaling doesn't support PMI report command (Information > PMI > Report). Is there a workaround to use this command in journal?

Problem 2: Then, I decided to try with macro recording. It launches the Excel spreadsheet succesfully, but I can't find the way to add some excel handling commands to the NX macro (e.g. Copy, Cut, Paste some columns). Is it possible to launch the excel spreadsheet, use these excel native commands, and then return to NX application by using a macro?

BTW, I'm using Windows XP, NX7.5

Any help is appreciated!
Thanks!
 
Replies continue below

Recommended for you

You say 'Macro' but I hope that you're actually talking about creating a 'Journal'. While Macros are still supported they are no longer recommended if you could use a Journal instead.

That being said, I'll let some others here respond since they have much more experience creating Journal and perhaps updating them into full-blown programs.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.
 
Yes, that's why I first tried to work with a journal, but some of the main commands that I need to work with, are not supported for journals (at least in NX 7.5). So I tried recording the "macro" as my last option, since I couldn't use a journal instead. But of course, if someone knows a workaround to do it with journals, that would be way better!

Thanks!
 
While I don't know for sure that this can be done with a VB program, which is basically what a Journal is, I can assure you that you will NEVER be able to do this with a Macro.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.
 
Ok, good to know, thanks John!. I hope someone knows if this can be achieved with a journal.

Thanks!
 
What information are you trying to get from the PMI to the table?

It will probably be easier to query the PMI object for the desired information and put it in the table directly, bypassing the PMI report entirely.

www.nxjournaling.com
 
cowski,

Mainly, I need to get the value, appended text, and tolerances from the PMI dimensions... What do you think?
 
Can you upload a small sample file that has a few example PMI dimensions and a table formatted with the desired information?

www.nxjournaling.com
 
I couldn't respond/test it yesterday, I had some issues at work, but I just did it... wow! this journal is great! I thought that the only way to get the values was through the PMI report. The only thing is that when you update a dimension or some tolerance, it overlaps the two values in the cell (Like in the attached picture).

Other than that, this is just great! exactly what I was looking for. Thank you very much cowski!
 
 http://files.engineering.com/getfile.aspx?folder=6a2ddd10-ec16-4aa7-b98e-f57fb5cbde71&file=PMIupdatecell.JPG
It creates a new table on each run, what you are seeing are 2 tables overlapped. I'll add some code to check for an existing table and delete it on subsequent runs...

Glad to hear it helps.

www.nxjournaling.com
 
oh I see, then that's the reason of the overlapping... Yes, that addition to check if a previous table exists would be great, thanks!... also I will try to check out and understand all the code and see if I can add that checking condition.

Thanks!
 
Will this be the only tabular note in the file? If so, it will be easier & faster just to delete all the tabular notes before creating the new one.

www.nxjournaling.com
 
Probably there will be just one note per file... you're right, it's easier to delete the tabular note as the first stpe of the process everytime the dimensions change than to modify the code, maybe in the future... Anyway I'll check the whole journal code, it's good to see how journals provide a wide spectrum of costumization for NX, I'm eager to continue learning about it. Again, thank you for your valuable help cowski!

Best Regards.
 
Actually, I meant that the journal could delete all the tabular notes in the file, IF the PMI dimension table is the only intended tabular note in the file. That would be an easier change to make in the journal vs checking for existing tables and deleting certain ones.

www.nxjournaling.com
 
right... I misunderstood hehe... yes, it will be the only one
 
No problem. That updated code works perfect! Thank you very much!

Best Regards.
 
Hi cowski,

I have another question for you, sorry for bring it up after a while... Is that possible to get also the dimensions contained in a whole assembly?. This journal works perfect with isolated parts, but when I'm trying to use it for an assembly, it just draws the headers of the table; which I think is expected because the dimensions are contained in the parts or subassemblies, not in the top assy. Do you think is possible to get the complete dimensions table contained in the assembly?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor