yadvdinesh
Aerospace
- Apr 13, 2015
- 31
Can someone plz tell me whey the loop in the below code is not getting terminated? Its going in an infinite loop.
Session *theSession = Session::GetSession();
Part *workPart(theSession->Parts()->Work());
UI *theUI = UI::GetUI();
ListingWindow *list=theSession->ListingWindow();
NXObject *nullNXObject(NULL);
list->SelectDevice(NXOpen::ListingWindow:eviceTypeWindow, "log.txt");
list->Open();
NXOpen::Assemblies::ComponentAssembly *rootAssembly = workPart->ComponentAssembly();
NXOpen::Assemblies::Component *rootComponent = rootAssembly->RootComponent();
vector<NXOpen::Assemblies::Component *> childComponents = rootComponent->GetChildren();
vector<NXOpen::Assemblies::Component *>::iterator itrComponent = childComponents.begin();
for(itrComponent = childComponents.begin() ; itrComponent != childComponents.end(); itrComponent++){
list->WriteLine("inside loop");
}
list->WriteLine("After the loop");
list->Close();
/* Terminate the API environment */
UF_CALL(UF_terminate());
}
Session *theSession = Session::GetSession();
Part *workPart(theSession->Parts()->Work());
UI *theUI = UI::GetUI();
ListingWindow *list=theSession->ListingWindow();
NXObject *nullNXObject(NULL);
list->SelectDevice(NXOpen::ListingWindow:eviceTypeWindow, "log.txt");
list->Open();
NXOpen::Assemblies::ComponentAssembly *rootAssembly = workPart->ComponentAssembly();
NXOpen::Assemblies::Component *rootComponent = rootAssembly->RootComponent();
vector<NXOpen::Assemblies::Component *> childComponents = rootComponent->GetChildren();
vector<NXOpen::Assemblies::Component *>::iterator itrComponent = childComponents.begin();
for(itrComponent = childComponents.begin() ; itrComponent != childComponents.end(); itrComponent++){
list->WriteLine("inside loop");
}
list->WriteLine("After the loop");
list->Close();
/* Terminate the API environment */
UF_CALL(UF_terminate());
}