<?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>what is the best way to delete everything in a file except visible elements in view 1.</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/137868/what-is-the-best-way-to-delete-everything-in-a-file-except-visible-elements-in-view-1</link><description>I am looking to remove everything in a dgn file except what is visible in view 1. It looks like mdlScanCriteria_setViewTest will scan what I want to keep.And then I suppose I could create a new file with the mdlWorkDgn functions. But in years past that</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: what is the best way to delete everything in a file except visible elements in view 1.</title><link>https://communities.bentley.com/thread/417188?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2017 14:44:00 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:4b602e10-0907-42ef-9857-24e2578666d6</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;In addition to Jan&amp;#39;s comments...&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;Ken Adams&amp;quot;]I would prefer something that would scan what I want to delete. Or is there a better way to accomplish this?[/quote]&lt;/p&gt;
&lt;p&gt;How many times are we asked for &lt;span style="font-family:courier new,courier;"&gt;mdlPersonal_doSomethingRemarkable()&lt;/span&gt;?&amp;nbsp; No, there isn&amp;#39;t a function that scans for what you want to delete: none of the MDL functions is involved with telepathy.&amp;nbsp; But here&amp;#39;s a suggestion...&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Scan for elements in your chosen view
&lt;ul&gt;
&lt;li&gt;Build a list of required Element IDs&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Scan the entire DGN model
&lt;ul&gt;
&lt;li&gt;Build a list of all Element IDs&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="padding:0;margin:0;"&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;From those lists, create a list of unrequired Element IDs&lt;/li&gt;
&lt;li&gt;Delete those elements&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;[quote user=&amp;quot;Ken Adams&amp;quot;]I am on Microstation SS3[/quote]&lt;/p&gt;
&lt;p&gt;I hope you&amp;#39;re using Viz Studio 2005 and writing C++.&amp;nbsp; Use the C++ standard containers to build your lists.&amp;nbsp; You may find &lt;span style="font-family:courier new,courier;"&gt;&lt;a href="http://www.cplusplus.com/reference/map/map/" title="cplusplus.com: std::map" target="_blank"&gt;std::map&lt;/a&gt;&amp;lt;ElementID&amp;gt;&lt;/span&gt; quite useful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: what is the best way to delete everything in a file except visible elements in view 1.</title><link>https://communities.bentley.com/thread/417179?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2017 14:14:04 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:265d2490-011b-4935-8ee4-cbfec81c3634</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi Ken,&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;Ken Adams&amp;quot;]But in years past that has not been the most reliable technique for me if the drawing has had any corruption in it.[/quote]&lt;/p&gt;
&lt;p&gt;Well, if data are corrupted, no code can work correctly, so a question is of the right problem is discussed.&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;Ken Adams&amp;quot;]What I would prefer is something that would scan what I want to delete. [/quote]&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t see any difference between to scan what to keep and to scan what to delete (which I guess is not possible). If you receive a list of what to keep, you can iterate graphical elements in the model again to create inverse list and to analyze if the elements are correct. I agree it requires more time.&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;Ken Adams&amp;quot;]Or is there a better way to accomplish this?[/quote]&lt;/p&gt;
&lt;p&gt;I am not sure if it&amp;#39;s better, but you can create a fence from view and using a proper fence mode, to process it&amp;#39;s content. A disadvantage of this approach is, I guess, it can be used in graphic mode only, so e.g. not if your application is INITAPP.&lt;/p&gt;
&lt;p&gt;[quote user=&amp;quot;Ken Adams&amp;quot;]BTW, I am on Microstation SS3.[/quote]&lt;/p&gt;
&lt;p&gt;It&amp;#39;s not BTW! :-)&amp;nbsp; According to &lt;a href="/products/programming/microstation_programming/f/343173/t/77384" target="_blank"&gt;MicroStation Programming Best practices&lt;/a&gt; a title of this post should be [V8i C] and in the post content you should mention exact build name, because SS3 can be whatever from an original SS3 release to Update 2.&lt;/p&gt;
&lt;p&gt;With regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>