Journal opening draft
Journal opening draft
(OP)
Hi All,
I'm looking for a journal which opens the draft of a model. I'm working native with master model drafts.
This draft is in the same directory and has the "_dwg1" addition to his name.
Can anyone help me with this journal, I wont be the first to have this question
Lars
I'm looking for a journal which opens the draft of a model. I'm working native with master model drafts.
This draft is in the same directory and has the "_dwg1" addition to his name.
Can anyone help me with this journal, I wont be the first to have this question

Lars
Lars
Solid Edge
Inventor
NX10.0.3.5 native





RE: Journal opening draft
Try this code.
CODE --> C#
// NX 9.0.3.4 // using System; using NXOpen; public class NXJournal { public static void Main(string[] args) { Session theSession = Session.GetSession(); Part workPart = theSession.Parts.Work; Part displayPart = theSession.Parts.Display; string partPath = workPart.FullPath; string partFolderPath = System.IO.Path.GetDirectoryName(partPath); string partName = System.IO.Path.GetFileNameWithoutExtension(partPath); string draftFileName = System.IO.Path.Combine(partFolderPath, partName + "_dwg1.prt"); if (System.IO.File.Exists(draftFileName)) { PartLoadStatus status; theSession.Parts.OpenDisplay(draftFileName, out status); status.Dispose(); } else { NXOpen.UI.GetUI().NXMessageBox.Show("Part not found", NXMessageBox.DialogType.Error, draftFileName + " does not exist"); } } public static int GetUnloadOption(string dummy) { return (int)Session.LibraryUnloadOption.Immediately; } }Thanks,
Selvaraj Chellamuthu
NX Automation Engineer
NX 9 | Teamcenter 10
RE: Journal opening draft
Thank you for your quick reaction.
When I paste this code into a journal I get al kind of errors. Can you please send the journal file ?
Thnx.
Lars
Lars
Solid Edge
Inventor
NX10.0.3.5 native
RE: Journal opening draft
Copy this code and paste it in empty text file and save the file with .cs extension.
If you get any error upload the error message snaps.
Thanks,
Selvaraj Chellamuthu
NX Automation Engineer
NX 9 | Teamcenter 10