cancel
Showing results for 
Search instead for 
Did you mean: 

Could not open part file in NX 7.5

Pioneer
Pioneer

Hello,

I've created an exe using NX wizard 7.5 in C++ and have got the nx session but could not open part file and work further. This is my code:

 

 

#include "stdafx.h"
using namespace NXOpen;
using namespace std;
using std::string;
using std::exception;
using std::stringstream;
using std::endl;
using std::cout;
using std::cerr;

Session *theSession = NULL;
int _tmain(int argc, _TCHAR* argv[])
{
theSession = NXOpen::Session::GetSession();
if(theSession != NULL)
{
MessageBox (NULL,"","GOT SESSION",MB_OK );
NXOpen::BasePart *basePart1;
NXOpen::PartLoadStatus *partLoadStatus1;
basePart1 = theSession->Parts()->OpenBaseDisplay("D:\\AssemblyViewer\\toycar_axle_assy.prt", &partLoadStatus1);

NXOpen::Part *workPart(theSession->Parts()->Work());
NXOpen::Part *displayPart(theSession->Parts()->Display());
NXString nxspartname = displayPart->Name() ;
const char * name = nxspartname.GetText();
MessageBox (NULL,name,"Part name",MB_OK );
}
else
{
MessageBox (NULL,"","No SESSION",MB_OK );
}

return 0;
}

 

Your help is appreciated!

1 REPLY

Re: Could not open part file in NX 7.5

Phenom
Phenom

Unless you have supplied a custom name to the part file, the name property is either null or empty. Instead of reporting the name, try reporing the part's FullPath property. It should have a value whether you are working in teamcenter or native NX.

 

NXString nxspartname = displayPart->FullPath() ;