Showing results for 
Search instead for 
Do you mean 

How to check the commit is feasible

Dear all,


I would like to create a series of intersection curves between some planes and faces. In some cases, the plane does not intersect with face. In that case, when I commit, Nx stops the code and return error message.

    NXOpen::NXObject *nXObject1;
    nXObject1 = intersectionCurveBuilder1->Commit();

How can know whether the commit is feasible or not before executing the commit command?

Or in other word, how can I check whether a datumplane intersects with some surfaces?


Thank you in advance




Re: How to check the commit is feasible

I would suggest querying the minimum distance between the face and the plane. If the distance is greater than zero, they don't intersect.

Re: How to check the commit is feasible

Some objects with a commit method offer a validate method too.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 ( | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: How to check the commit is feasible

If there is no "validate" (or anything else), like I suggested in the other thread, enclose the code in a try...catch block and check the error is "no intersection" or "somethinge lse" (I don't know what other reasons it would fail, but there may be some)

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled

Re: How to check the commit is feasible

The builder object's .Validate method will ensure that you have supplied enough information to call the .Commit method, but it does not necessarily guarantee that the builder will successfully create the feature. For instance, in the case of an intersection feature, .Validate would return false if you only specified one of the two necessary objects for the intersection operation. A value of true would indicate that both objects have been specified, but would not guarantee that they intersect.

Re: How to check the commit is feasible

There are some quick easy checks that you can do to see if the two objects could possibly intersect. For example, if the objects' bounding boxes don't overlap, then they can't possibly intersect. But it doesn't work the other way around -- if the bounding boxes do overlap, then the objects may or may not intersect. The only way to know for sure is to try intersecting them. This might seem like it would be very slow, but, internally, the intersection functions use boxing and other tricks to avoid actually doing the intersection calculation if it obviously won't produce anything.


Re: How to check the commit is feasible

I enclosed the commint command in a try and catch block written by myself, but it turns out that, the code will in the end run into the try and catch block generated by Nxopen wizard.

In the following, I attched one part of the code generated by Nxopen c++ wizard. As you can see, it contains a try and catch block. Once the commit command fails, no matter whether I define try and catch block in the function do_it or not, the code will run into the default try and catch command and show the error in NX


		// Create NXOpen C++ class instance
		MyClass *theMyClass;
		theMyClass = new MyClass();
		delete theMyClass;
    catch (const NXException& e1)
		UI::GetUI()->NXMessageBox()->Show("NXException", NXOpen::NXMessageBox::DialogTypeError, e1.Message());
	catch (const exception& e2)
		UI::GetUI()->NXMessageBox()->Show("Exception", NXOpen::NXMessageBox::DialogTypeError, e2.what());
	catch (...)
		UI::GetUI()->NXMessageBox()->Show("Exception", NXOpen::NXMessageBox::DialogTypeError, "Unknown Exception.");


Re: How to check the commit is feasible

Thank you for your reply. The idea sounds great. I will try to implement the method in these days