dhaval082
Mechanical
- Jun 24, 2013
- 26
i have use this code
using System;
using NXOpen;
using NXOpen.UF;
using System.Runtime.InteropServices;
public class Program
{
// class members
private static Session theSession;
private static UFSession theUfSession;
public static Program theProgram;
public static bool isDisposeCalled;
//------------------------------------------------------------------------------
// Constructor
//------------------------------------------------------------------------------
public Program()
{
try
{
theSession = Session.GetSession();
theUfSession = UFSession.GetUFSession();
isDisposeCalled = false;
//code
//Session theSession = Session.GetSession();
Part workPart = theSession.Parts.Work;
Part displayPart = theSession.Parts.Display;
// ----------------------------------------------
// Menu: File->Close->Save As and Close...
// ----------------------------------------------
PartSaveStatus partSaveStatus1;
partSaveStatus1 = workPart.SaveAs("C:\\Users\\Dhaval\\Desktop\\PISTON_9HSE_411_2");
partSaveStatus1.Dispose();
workPart.Close(NXOpen.BasePart.CloseWholeTree.True, NXOpen.BasePart.CloseModified.DontCloseModified, null);
workPart = null;
displayPart = null;
}
catch (NXOpen.NXException ex)
{
// ---- Enter your exception handling code here -----
// UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.Error, ex.Message);
}
}
//------------------------------------------------------------------------------
// Explicit Activation
// This entry point is used to activate the application explicitly
//------------------------------------------------------------------------------
public static int Main(string[] args)
{
int retValue = 0;
try
{
theProgram = new Program();
//TODO: Add your application code here
theProgram.Dispose();
}
catch (NXOpen.NXException ex)
{
// ---- Enter your exception handling code here -----
}
return retValue;
}
//------------------------------------------------------------------------------
// Following method disposes all the class members
//------------------------------------------------------------------------------
public void Dispose()
{
try
{
if (isDisposeCalled == false)
{
//TODO: Add your application code here
}
isDisposeCalled = true;
}
catch (NXOpen.NXException ex)
{
// ---- Enter your exception handling code here -----
}
}
}
using System;
using NXOpen;
using NXOpen.UF;
using System.Runtime.InteropServices;
public class Program
{
// class members
private static Session theSession;
private static UFSession theUfSession;
public static Program theProgram;
public static bool isDisposeCalled;
//------------------------------------------------------------------------------
// Constructor
//------------------------------------------------------------------------------
public Program()
{
try
{
theSession = Session.GetSession();
theUfSession = UFSession.GetUFSession();
isDisposeCalled = false;
//code
//Session theSession = Session.GetSession();
Part workPart = theSession.Parts.Work;
Part displayPart = theSession.Parts.Display;
// ----------------------------------------------
// Menu: File->Close->Save As and Close...
// ----------------------------------------------
PartSaveStatus partSaveStatus1;
partSaveStatus1 = workPart.SaveAs("C:\\Users\\Dhaval\\Desktop\\PISTON_9HSE_411_2");
partSaveStatus1.Dispose();
workPart.Close(NXOpen.BasePart.CloseWholeTree.True, NXOpen.BasePart.CloseModified.DontCloseModified, null);
workPart = null;
displayPart = null;
}
catch (NXOpen.NXException ex)
{
// ---- Enter your exception handling code here -----
// UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.Error, ex.Message);
}
}
//------------------------------------------------------------------------------
// Explicit Activation
// This entry point is used to activate the application explicitly
//------------------------------------------------------------------------------
public static int Main(string[] args)
{
int retValue = 0;
try
{
theProgram = new Program();
//TODO: Add your application code here
theProgram.Dispose();
}
catch (NXOpen.NXException ex)
{
// ---- Enter your exception handling code here -----
}
return retValue;
}
//------------------------------------------------------------------------------
// Following method disposes all the class members
//------------------------------------------------------------------------------
public void Dispose()
{
try
{
if (isDisposeCalled == false)
{
//TODO: Add your application code here
}
isDisposeCalled = true;
}
catch (NXOpen.NXException ex)
{
// ---- Enter your exception handling code here -----
}
}
}