mdlModelRefIterator_getNext (iterator)

I am attempting to cycle through all the cells in a library by stepping through the models. The following code would

seem to be a logical way to achiever this. However, it retrieves only the current (active) model, and then the process

exits (no further processing). What am I doing incorrectly?

mdlModelRefIterator_create (&iterator, MASTERFILE, MRITERATE_Root | MRITERATE_PrimaryChildRefs , -1);
while (modelRefP = mdlModelRefIterator_getNext (iterator))
{
     mdlModelRef_getModelName (modelRefP, WmodelName);
     mdlCnv_convertUnicodeToMultibyte (WmodelName, -1, modelName, sizeof(modelName));
     printf ("Model Name-> %s\n", modelName);
}

On a side note, when I attempt to cycle through all the cells with the following code (using an index iterator), it performs as

expected and steps through each cell (model).

fileObj = mdlModelRef_getDgnFile(MASTERFILE);
ndxIterator = mdlModelIterator_create (fileObj);
mdlModelIterator_setAcceptCellsOnly (ndxIterator, TRUE);
while (NULL != (IndexItem = mdlModelIterator_getNext (ndxIterator)))
{
mdlModelItem_getName (IndexItem, WmodelName, MAXFILELENGTH);
mdlCnv_convertUnicodeToMultibyte (WmodelName, -1, modelName, sizeof(modelName));
mdlModelItem_getDescription (IndexItem, WmodelDesc, MAXFILELENGTH);
mdlCnv_convertUnicodeToMultibyte (WmodelDesc, -1, modelDesc, sizeof(modelDesc));
printf ("Model Name-> %s Description-> %s\n", modelName, modelDesc);

}

Any suggestions?

Larry Durke

Parents Reply Children
No Data