×
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

Journal opening draft

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 bigglasses

Lars


Lars
Solid Edge
Inventor
NX10.0.3.5 native

RE: Journal opening draft

Hi,
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

(OP)
SelvarajC,

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

Hi,
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

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