Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

NXOpen C++ Exception In UGNX 5.0

virat_gangurde

New member
<DIV id=inbdy><A name=msg_fee8f69b37a45d72></A>


Here i am exploring geometry using user function in UGNX 5.0 as
follows.



We have written the following code for creating an empty part file.



_gbl_UGSession = Session::GetSession();



PartLoadStatus *pls;



PartCollection *pc = _gbl_UGSession->Parts();



SaveOptions *sp = pc->SaveOptions();



sp->SetVisualizationData(TRUE);



try{



printf("mnxnode_DSO_INIT -------------- created basepart\n
\n");



_gbl_UGBasePart = pc->NewBaseDisplay("C:\TEMP\part1.prt",
NXOpen::BasePart::UnitsMillimeters);



}



catch(const NXException &ex){



_gbl_UGBasePart = pc->OpenBaseDisplay("C:\TEMP\part1.prt",
&pls);



}



After creating the empty part file we create a 3d Cartesian point with
the following code
try{
Part *workPart(_gbl_UGSession->Parts()->Work());
Part *displayPart(_gbl_UGSession->Parts()->Display());
Point *point1;
point1 = workPart->Points()->CreatePoint(Point3d(x, y, z));
//ret = new MNXNode(point1);
Feature *nullFeatures_Feature(NULL);
PointFeatureBuilder *pointFeatureBuilder1;
pointFeatureBuilder1 =workPart->BaseFeatures()->CreatePointFeatureBuildernu llFeatures_Feature);
pointFeatureBuilder1->SetPoint(point1);
NXObject *nXObject1;
nXObject1 = pointFeatureBuilder1->Commit();
pointFeatureBuilder1->Destroy();
}



catch (const NXException &ex)
{
printf("Exception is '%s'\n", ex.Message());



}



But we are getting a runtime exception on the commit command
( exception : Unable to reference associative basic curve ). Can you
pls suggest to overcome the exception



Thanks in advanced.
</DIV>
 

Sponsor

Articles From 3DCAD World

Back
Top