Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

NXOpen-FitCurve

Status
Not open for further replies.

AnotherMike

Aerospace
Feb 24, 2014
21
0
0
GB
I just find an interesting thing.
I record the fitting curve process using c#.
The final part of the code is like below.
.....
NXObject nXObject7;
nXObject7 = fitCurveBuilder1.Commit();
......

If you run the code, you get a fit curve feature in the feature tree.
But unlike other "builder.commit", the result (nXObject7) of this "fitCurveBuilder.Commit" is "null".
Whenever you use this "nXObject7", for example, string a=nXObject7.JournalIdentifier, you will get "System.NullReferenceException: Object reference not set to an instance of an object" error.

Does anyone knows what happens here?
Thank you.
 
Replies continue below

Recommended for you

I have tried several situations and all got the same result.

A simple test:
if (fitCurveBuilder1.Commit() == null)
{
lw.WriteLine("aaaaaaaaaaaaa");
}

Then you do get "aaaaaaaaaaaaaa".
But there is a fit curve feature created in the feature tree.
 
The commit method for fitcurvebuilder indicates that "Commits any edits that have been applied to the builder". If you want to access the fitcurve feature then use the CommitFeature method.

 
Hi FranKSwinks,

Thank you.
I have tried it, but the feature you get from "fitCurveBuilder.CommitFeature()" is still "null".
I never met this kind of problem before.
 
I took another look at this. First I assume you are using NX8.5? My code is using VB.

After the fitcurve has been created you can get the feature like this

Dim fitcurvefeat As features.feature = fitCurveBuilder1.getfeature

Hope this helps.

Frank Swinkels

 
Status
Not open for further replies.
Back
Top