Showing results for 
Search instead for 
Do you mean 
Reply

Add UDO in FemPart

Hello, 

 

As many new developers, I'm facing problems with UDO. First I explain the context, the I show a piece of code.

 

I want to create a Multiphysic driver, and do my own dialogs in order to apply some filtering in the options available when (for example) you define a material's property.

 

Because when you are working in a FEM part is not possible to access to the SolverProperty of the current solution, the advice that I received was to create an UDO in the FemPart.

 

Here you will see the code to create the UDO, but seems is not attached to the FemPart:

 

void DialogMP::loadConfiguration(NXOpen::CAE::FemPart* femPart)
{
...

UserDefinedClass* theMPUDOclass;

// MP_UDO class was created in the ufsta() DLL entry point
theMPUDOclass = theSession->UserDefinedClassManager()->GetUserDefinedClassFromClassName("MP_UDO");

UserDefinedObjectManager* udoManager = femPart->UserDefinedObjectManager();

// Creating a new UDO
UserDefinedObject* myUDO = udoManager->CreateUserDefinedObject(theMPUDOclass);

vector<UserDefinedObject*> udos = udoManager->GetUdosOfClass(theMPUDOclass);

// Why vector is empty?
cout<<udos.size()<<" this is 0"<<endl;

...
}

 

Why udos vector is always empty? I expected to have one new object every time I execute this method.

 

Does UserDefinedObjectManager::CreateUserDefinedObject (that belongs to a FemPart) associate the UDO with the FemPart automatically?

 

Could someone give me orientation about this? I read the forum for other UDOs questions and the NX help, but still not clear for a newbie.

 

 

Thanks for your time.

1 REPLY

Re: Add UDO in FemPart

For the first time, you should create your class and put the permission to on to be able to query the class from its name afterwards:

 

udClass = m_session->UserDefinedClassManager()->CreateUserDefinedObjectClass(name, friendlyName);
udClass->SetAllowQueryClassFromName(NXOpen::UserDefinedObjects::UserDefinedClass::AllowQueryClassOn);

 

Elias.