Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error code 945001

Status
Not open for further replies.

WilsonBlr

Aerospace
Jun 11, 2014
19

Hello all,

I am trying to create a .dll using NX Open to create surface. I wrote a function which returns the error 945001. I am not able to find out what error 945001 actually is. Below is the function code. This function accepts an array of points and creates a spline from those points and returns the control points of the spline. I am calling this dll from a console application.

//////////////////////////////////////////////////////////////
std::vector<Points> GetCtlPoints(double ptArray[][3], int size)
{
std::vector<Points> splineControlPoints;

std::vector<NXOpen::point3d> Points;
SPLINE_FIT_t tFitSplineData; // Spline Curve Structure

double dMaxErr = 0.0; // Maximum err value
double dTolerance = 0.0001; // Default Tolerance value

tag_t tGeometry = NULL_TAG; // Tag of the geometry

NXOpen::point3d Pt(0,0,0); // Instance to point class
bool bIsFeature = false;

for(int i=0; i<size; i++)
{
Pt.X = ptArray[0];
Pt.Y = ptArray[1];
Pt.Z = ptArray[2];
Points.push_back(Pt);
}

tFitSplineData.weights = NULL;
tFitSplineData.num_of_weights = 0;
tFitSplineData.weight_positions = NULL;
tFitSplineData.num_of_segments = 0;
tFitSplineData.tolerance = 0.0001;
tFitSplineData.degree = 3;
tFitSplineData.num_of_points = Points.size();

// error code
int nErrorCode=0;
int nPt=0;
// allocate memory
tFitSplineData.points = (double*) malloc(3*(Points.size())*sizeof(double));
// copy data to UF Array
for (nPt = 0; nPt < Points.size(); nPt++)
{
double dTempPt[3] = {Points.at(nPt).X, Points.at(nPt).Y, Points.at(nPt).Z};
tFitSplineData.points[nPt*3+0]=dTempPt[0];
tFitSplineData.points[nPt*3+1]=dTempPt[1];
tFitSplineData.points[nPt*3+2]=dTempPt[2];
//UF_VEC3_copy(dTempPt, &tFitSplineData.points[nPt*3]);
}

// no slope
tFitSplineData.slope_flag = 0; // No Slope exists
tFitSplineData.slopes = NULL;
// Create Fit Spline with the above structure filled
UF_CALL (UF_MODL_create_fitted_spline(&tFitSplineData, &dMaxErr, &nErrorCode, &tGeometry) );

// Free the memory and lists


// Some code to get control points from the fitted spline

return splineControlPoints;

}



//////////// ERROR ///////////////////////

*** ERROR system never initialised, sending output to stderr ***
*** ERROR code 945001 at line 196 in NX8_Open2.cpp:
+++ NO error text found for error 945001
UF_MODL_create_fitted_spline(&tFitSplineData, &dMaxErr, &nErrorCode, &tGeometry);
*** ERROR code 945001 at line 196 in NX8_Open2.cpp:
+++ NO error text found for error 945001
UF_MODL_create_fitted_spline(&tFitSplineData, &dMaxErr, &nErrorCode, &tGeometry);


Could anybody please help me understand what I may be missing here?
Is there a comprehensive documentation of error codes and what each error code means ?


Thanks in advance
Wilson


 
Replies continue below

Recommended for you


Line 196 : UF_CALL (UF_MODL_create_fitted_spline(&tFitSplineData, &dMaxErr, &nErrorCode, &tGeometry) );
 

more info :
There is no compile time error. At runtime, the console window (console app that calls this dll) shows the above message. Program returns from the dll function without error.
 
This may not be the only problem, but I don't think it is reasonable to create a spline with zero segments.

Code:
tFitSplineData.num_of_segments = 0;

www.nxjournaling.com
 
UF_get_fail_message translates error 945001 to "NX License Error: Context based licensing functionality invoked without initializing contexts". Did you call UF_initialize() at the start of your application? That "system never initialised" error suggests that you didn't...
 

Thanks a ton Cowski and Bleaker.

I was missing the initialization, hence the error. Now I see the application running after adding UF_initialize()
 


Is there a way to get the control points of a spline created through

UF_CALL (UF_MODL_create_fitted_spline(&tFitSplineData, &dMaxErr, &nErrorCode, &tGeometry) );


I have the tGeometry. Can this be casted to any spline class which can return the control points.
 
I haven't used this function and can't give much advice there, but its documentation entry states that "The system does not store defining points for curves created using the spline creation function." So it seems you are out of luck there. Perhaps you can coax *some* points out of the curve with UF_MODL_ask_curve_points, but these probably won't be the actual control points. You can also try using an evaluator (UF_EVAL_initialize / UF_EVAL_is_spline / UF_EVAL_ask_spline_control_pts), but since the "tGeometry" object is actually a curve, and not a spline, I'd guess that UF_EVAL_is_spline will just return false.

Now, to your question - whereas downcasting to try and get the data that isn't there is guaranteed to fail, on the off chance that it was secretly put there by crafty NX devs, you can still try it with:

NXOpen::Spline *foo = dynamic_cast<NXOpen::Spline*>(NXOpen::NXObjectManager::Get(tGeometry)); // Don't forget the necessary includes like spline.hxx

Please don't hold me liable if (or rather, when) your computer explodes spectacularly or turns into a giant flesh-eating monster as a result of this heresy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor