Showing results for 
Search instead for 
Do you mean 

Get CAEFace from a Fem in a SimPart



I have some problems for my code trying to create regions.I am in the Sim Part, and I want to create regions made of faces. I need to be int he SimPart to create Regions, and the faces are in the FemPart.

Journaling gives me code using "FindObject". 


std::vector<NXOpen::CAE::SetObject> objects1(2);
NXOpen::Assemblies::Component *component1(dynamic_cast<NXOpen::Assemblies::Component *>(workSimPart->ComponentAssembly()->RootComponent()->FindObject("COMPONENT 0_Stitched_Biaxial_20170130_1146_fem 1")));
NXOpen::CAE::CAEFace *cAEFace1(dynamic_cast<NXOpen::CAE::CAEFace *>(component1->FindObject("PROTO#CAE_Body(16)|CAE_Face(149)")));
objects1[0].Obj = cAEFace1;
objects1[0].SubType = NXOpen::CAE::CaeSetObjectSubTypeNone;
objects1[0].SubId = 0;
NXOpen::CAE::CAEFace *cAEFace2(dynamic_cast<NXOpen::CAE::CAEFace *>(component1->FindObject("PROTO#CAE_Body(21)|CAE_Face(187)")));
objects1[1].Obj = cAEFace2;
objects1[1].SubType = NXOpen::CAE::CaeSetObjectSubTypeNone;
objects1[1].SubId = 0;


I tried to use directly the CAEFace retrieved from the FEM but I get an error: "Selected objects are not in the same file as Targetset". 

I suppose there is something specific to do in this case. I attached the full journal.


Do you have an idea ?


Thanks for your help !




Re: Get CAEFace from a Fem in a SimPart

You can't reference the CaeFace in the FemPart. You need to use the occurrence of the CAEFace that is in the SimPart.

Re: Get CAEFace from a Fem in a SimPart

Well I found a way to do it.

In the SIM, I retrieve the name of the FEM part and retrieve the assembly component from which I can retrieve the occureneces of the CAE Faces.


I guess there's a better way to do it, but it works though.


//Get FEM component to retrieve CAEFace
string femName = simPart->FemPart()->Name().GetText();
string femObjName = "COMPONENT " + femName + " 1";
NXOpen::Assemblies::Component *componentFem(dynamic_cast<NXOpen::Assemblies::Component *>(simPart->ComponentAssembly()->RootComponent()->FindObject(femObjName)));
std::vector<NXOpen::CAE::SetObject> objects1(vecFaces.size());
for (int iFace = 0; iFace != vecFaces.size(); iFace++)
	objects1[iFace].Obj = componentFem->FindOccurrence(vecFaces[iFace]);
	objects1[0].SubType = NXOpen::CAE::CaeSetObjectSubTypeNone;
	objects1[0].SubId = 0;