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.
Hi Loren,
This code snip will delete all raster attachments using only the C++ API.
Raster::DgnRasterVector rasterV; Raster::DgnRasterCollection::QueryRastersOrderedList(rasterV, ISessionMgr::GetActiveDgnModelRefP()); for (auto rasterP : rasterV) { rasterP->DeleteFromModel(); }
HTH,Bob
Answer Verified By: Loren
Hi Bob,
Works perfectly! Thanks.