Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Export CGM Filename 2

Status
Not open for further replies.

carlharr

Mechanical
Mar 20, 2012
389
Morning,

Does anyone know if it is possible to change the default style of filename for an exported CGM (exported to windows) from NX8.5?

For example, if we export 123/A1234 revision A the file comes out as 123SA1234_DWG_A, but when we export to Teamcenter the format is taken from sheet name in part navigator i.e. 123-A1234-A-SHEET1

Apart from having to rename for every export, this also means we need to export multi-sheet drawings one-by-one, as otherwise all sheets have the same filename.

So, is it possible to export CGMs to windows using the sheetnames from Part Navigator, in the same way as the "export drawings to Teamcenter" command works?

Thanks, Carl



NX 8.5 with TC 8.3
 
Replies continue below

Recommended for you

The last parameter to the GetSetting function is optional; if there is no value in the specified key ("ExportPath"), "H:\My Documents\Carls Documents" is the value that will be returned. You can omit the value entirely from the GetSetting function since there is an If block that will set the outputDir to MyDocuments if no value is found. Or, you could use the My.Computer.FileSystem.SpecialDirectories.MyDocuments as the optional parameter and eliminate the If block entirely. Either strategy should work, it would simply be a matter of style. The 2nd strategy would allow you to save a few lines of code, which is oddly important to some programmers - similar to how some NX users strive for the minimum number of features in their models. Personally, I prefer clarity over conciseness if I can't have both.


What you currently have will also work for any user, but may be a bit confusing if/when you revisit the code at a later date. When I run the code and there is no value in the "ExportPath" key, "H:\My Documents\Carls Documents" is returned as the outputDir. The If block then checks to see if this path exists; of course it doesn't exist on my computer so it then sets the outputDir to My.Computer.Filesystem... which does exist on my computer. So, even though it works, you could simplify the code by using one of the strategies above.

www.nxjournaling.com
 
Cowski,

Thank you for your description, think I understand (it's taken me a while)!

So the folder at the end of outputDir line will be the pre-selected folder in the browser, unless there is a stored folder in the registry key "ExportPath", which comes earlier in that line.
And if the specified folder doesn't exist, the if function would sort out that problem anyway.

For simplicity, I'll leave the line as:
outputDir = GetSetting("NX journal", "Export CGM", "ExportPath", "H:\My Documents")

So final version of the journal with browser selector is attached.

And yes you're right, for CAD models the aim should always be clarity.

Thank you and Mike for your help, Carl

NX 8.5 with TC 8.3

 
Carl

So that's you first program done. Have a look around on Eng-Tips but also on GTAC and Cowski's site (NXJournaling) for more ideas for your next one, now you are a programmer!

Cowski
Sorry to leave you picking up the pieces after me making some suggestions. I learnt some new tricks as well though from it. I'm in the middle of a Check-Mate course so haven't been able to contribute this week. KF is not as friendly to use as VB.

Mike Hyde
NX8.5 with TC9.1
 
Mike,
Carl did the hard work, I just gave some advice along the way.

Carl,
Congrats on your finished program, I have a feeling it won't be your last!

www.nxjournaling.com
 
Thank you, I'm pleased it works but I really can't take any credit - all down to you two chaps!

I did wonder about producing EMF files from the plot menu in the same way, for design presentations etc. (as CGMs vs MS Office has reared it's head again), but I'm already booked up for most of October so that will have to wait.

Which suits me fine, my head has turned to mush.



NX 8.5 with TC 8.3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor