[CONNECT/C++] How to detach all Rasters?

I am using the following code to detach all rasters but it only detaches some, for example when 5 rasters are attached (via raster manager not code) all but 2 are detached - what am I missing?

DgnModelRefP  modelRef = mdlModelRef_getActive();
mdlRaster_initialize();
for each(DgnRasterP rasterP in DgnRasterCollection::GetRasters(modelRef))
    {
    if (NULL != rasterP)
        {
        mdlRaster_detach(rasterP, 0);
        }
    }
mdlRaster_terminate();

Thanks in Advance,

Loren.

Parents Reply Children
No Data