<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>[CONNECT/C++] How to detach all Rasters?</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/237908/connect-c-how-to-detach-all-rasters</link><description>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? 
 
 Thanks in Advance, 
 Loren.</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: [CONNECT/C++] How to detach all Rasters?</title><link>https://communities.bentley.com/thread/740362?ContentTypeID=1</link><pubDate>Fri, 04 Nov 2022 16:54:26 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:322744f0-e630-43da-b61c-c61cbbc4e3e5</guid><dc:creator>Loren</dc:creator><description>&lt;p&gt;Hi Bob,&lt;/p&gt;
&lt;p&gt;Works perfectly! Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [CONNECT/C++] How to detach all Rasters?</title><link>https://communities.bentley.com/thread/740233?ContentTypeID=1</link><pubDate>Fri, 04 Nov 2022 02:43:39 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:d3bc7014-c62b-404c-8ffd-1039bf2380df</guid><dc:creator>Robert Hook</dc:creator><description>&lt;p&gt;Hi &lt;a class="internal-link view-user-profile" href="/members/caa79885_2d00_f86c_2d00_4a3e_2d00_99b2_2d00_f09f8dceac72"&gt;Loren&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;This code snip will delete all raster attachments using only the C++ API.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;Raster::DgnRasterVector rasterV;
Raster::DgnRasterCollection::QueryRastersOrderedList(rasterV, ISessionMgr::GetActiveDgnModelRefP());
for (auto rasterP : rasterV)
{
	rasterP-&amp;gt;DeleteFromModel();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;br /&gt;Bob&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>