×
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

Using excel commands within a NX macro

Using excel commands within a NX macro

Using excel commands within a NX macro

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

RE: Using excel commands within a NX macro

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.

RE: Using excel commands within a NX macro

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

RE: Using excel commands within a NX macro

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.

RE: Using excel commands within a NX macro

(OP)
Ok, good to know, thanks John!. I hope someone knows if this can be achieved with a journal.

Thanks!

RE: Using excel commands within a NX macro

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

RE: Using excel commands within a NX macro

(OP)
cowski,

Mainly, I need to get the value, appended text, and tolerances from the PMI dimensions... What do you think?

RE: Using excel commands within a NX macro

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

RE: Using excel commands within a NX macro

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

RE: Using excel commands within a NX macro

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

RE: Using excel commands within a NX macro

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

RE: Using excel commands within a NX macro

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

RE: Using excel commands within a NX macro

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

RE: Using excel commands within a NX macro

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

RE: Using excel commands within a NX macro

(OP)
right... I misunderstood hehe... yes, it will be the only one

RE: Using excel commands within a NX macro

Sorry, I typed out a quick response and I wasn't as clear as I should have been.

Updated code

www.nxjournaling.com

RE: Using excel commands within a NX macro

(OP)
No problem. That updated code works perfect! Thank you very much!

Best Regards.

RE: Using excel commands within a NX macro

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

RE: Using excel commands within a NX macro

I'd suggest setting up a 'container' to hold all the data (2d array, data table, collection, etc), cycle through the components making each the work part in turn, collect the PMI dimension information (as done in the journal) adding the info to the 'container' of choice, and finally switch back to the assembly file to create the tabular note using the information from the 'container'. Bear in mind that the tabular note contents are not associative to the PMI dimensions; if/when any component changes, the tabular note will need to be updated or recreated.

www.nxjournaling.com

RE: Using excel commands within a NX macro

(OP)
OK, sounds good, I'll give it a try. Thank you!

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