I am porting my old v8i code to Connect and suddenly the code below is not working anymore. The code below will scan a certain level for element descriptors and I check if the type is a complex shape. If so, I will iterate through the children of the complex shape. I see the element descriptor and that it has # components, but it never jumps into the for loop.
Does anyone know why the ChildElemIter is not working?
// Setup scan
scP = mdlScanCriteria_create();
if(!scP) return ERROR;
mdlScanCriteria_setModel (scP, MASTERFILE);
mdlScanCriteria_addSingleLevelTest(scP , id);
mdlScanCriteria_setDrawnElements(scP);
mdlScanCriteria_setReturnType (scP, MSSCANCRIT_ITERATE_ELMDSCR, FALSE, FALSE);
mdlScanCriteria_setElmDscrCallback (scP, MyCallback, MASTERFILE);
mdlScanCriteria_scan (scP, 0, 0, 0);
mdlScanCriteria_free(scP);
// Callback function
void MyCallback(MSElementDescr *ElDscr, void *modelRef)
{
if(mdlElement_getType(&ElDscr->el) == CMPLX_SHAPE_ELM)
{
ElementHandle eh (ElDscr, false, true);
for (ChildElemIter child (eh); child.IsValid(); child = child.ToNext()) // Never jumps into this loop
{
// Do something with each line in the complex shape.
}
}
}