Showing results for 
Search instead for 
Do you mean 
Reply

BlockStyler::ListBox::SetListItems doesn't work in Debug

Hello.

I am working with NX 11.0.0.33.

I have a dialog created with Block Styler UI that contains a NXOpen::BlockStyler::ListBox and I would like to populate this list with the names of all the Modeling Objects available. The problem is that this works as expected if the solver plugin is compiled in Release, but it doesn't work in Debug. I am not comfortable with this because I think there's a leak somewhere, but I can't find it.

 

This is the code. 

 

void DialogExportModelingObject::dialogShown_cb()
{
    try
    {
        //---- Enter your callback code here -----
	PartCollection* parts = theSession->Parts();
	BasePart* basePart = parts->BaseWork();
	CAE::FemPart* femPart = (CAE::FemPart*) basePart;

	NXOpen::CAE::ModelingObjectPropertyTableCollection modObjPropTableCollection(femPart);
	NXOpen::CAE::ModelingObjectPropertyTableCollection::iterator itModObjs = modObjPropTableCollection.begin();

	std::vector<NXOpen::NXString> listOfItems;
	NXOpen::CAE::ModelingObjectPropertyTable* theModObj;
	while (itModObjs != modObjPropTableCollection.end())
	{
		theModObj = *itModObjs;
		listOfItems.push_back(theModObj->Name());
		++itModObjs;
	}
	listModelingObjects->SetListItems(listOfItems);
		
    }
	catch (NXException& ex)
    {
        //---- Enter your exception handling code here -----
        DialogExportModelingObject::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
    }
}

When I execute this, being compiled in Debug, sometimes I get an error: Unhandled exception encountered in callback automation code. And the dialog is not shown.

In other cases, a Microsoft Visual C++ dialog opens saying:

Debug Error!
Program: (path to ugraf.exe inside NX11 installation)
abort() has been called
.
And NX is closed.

 

In the Log, I see the following (only in Debug, of course):

+++ Area does not support very large request 18446744073708348176
*** EXCEPTION: Error code  902 in line 172 of o:\ugnx110\ip33\src\syss\sm\ind\sm_init.c at Fri Jul 14 16:29:04 2017 Romance Summer Time
+++ Bad size (2147483583) for allocation request

In Release, everything works....Any ideas? 

Thank you!

3 REPLIES

Re: BlockStyler::ListBox::SetListItems doesn't work in Debug

Re: BlockStyler::ListBox::SetListItems doesn't work in Debug

Indeed that post was useful to me. If I understood well, there's no way for me to use this code in debug mode, and that is by design. I can't build part of my code to MD because it is integrated with lots of classes and the separation is not easily possible.

It is good to know this, so I can't stop looking at this (unsolvable) problem...

Thank you very much for your answer!

Re: BlockStyler::ListBox::SetListItems doesn't work in Debug

There is probably a solution, or at least a tenable work-around, perhaps @SteveLabout can advise...