<?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>Get Nearest Polygon</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/bdn-vba/93291/get-nearest-polygon</link><description>Dear All, 
 How to get the nearest Polygons which contains the selected elements (using VBA)? 
 In the attached screenshot, the Majenta color represents the selected elements and the corresponding nearest polygons was represented in Green color.</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Get Nearest Polygon</title><link>https://communities.bentley.com/thread/269860?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2013 03:15:59 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:86efd177-9d39-4404-9f02-fbff01a27dd8</guid><dc:creator>Dharma Rajan</dc:creator><description>&lt;p&gt;Thank You :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get Nearest Polygon</title><link>https://communities.bentley.com/thread/269775?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2013 13:28:44 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:8556770c-cea0-4cef-80ea-1cb88da5dede</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Dharmarajan&amp;quot;] &amp;nbsp;If fEl.ID.Low &amp;lt;&amp;gt; selectedElemnt.ID.Low[/quote]&lt;/p&gt;
&lt;p&gt;Don&amp;#39;t use that test; you&amp;#39;re considering only half the element ID.&amp;nbsp; Prefer to use this...&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new,courier;"&gt;If 0 = DLongComp (fEl.ID, selectedElement.ID)&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get Nearest Polygon</title><link>https://communities.bentley.com/thread/269721?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2013 09:09:11 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:ef6a428e-f189-4fbe-878c-bd12fb9e710c</guid><dc:creator>Dharma Rajan</dc:creator><description>&lt;p&gt;Thanks Jon.&lt;/p&gt;
&lt;p&gt;I followed your suggestion with a slight change as given below(since the selected elements are polygon. we can use them as fence). &lt;/p&gt;
&lt;p&gt;CadInputQueue.SendKeyin &amp;quot;CHANGE VIEW CUSTOM &amp;quot;&amp;quot;Smooth&amp;quot;&amp;quot; 1&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;#39;&amp;#39;now create a fence - Type = Element,Mode = Overlap&lt;/p&gt;
&lt;p&gt;createPolygonasFence selectedElemnt&lt;/p&gt;
&lt;p&gt;Set elemntEnumerator = ActiveDesignFile.Fence.GetContents&lt;/p&gt;
&lt;p&gt;While elemntEnumerator.MoveNext&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Set fEl = elemntEnumerator.Current&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;If fEl.ID.Low &amp;lt;&amp;gt; selectedElemnt.ID.Low Then And fEl.IsShapeElement Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#39;&amp;#39;other statements&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt;Wend&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get Nearest Polygon</title><link>https://communities.bentley.com/thread/269709?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2013 07:26:47 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:184ad2a8-29ab-414a-8edc-6a9c64c5eadd</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Dharmarajan&amp;quot;]How to get the nearest polygons which contains the selected elements?[/quote]&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Build a list of polygons (shape elements)&lt;/li&gt;
&lt;li&gt;Iterate your list of polygons&lt;/li&gt;
&lt;li&gt;For each polygon&lt;ol&gt;
&lt;li&gt;Create a fence&lt;/li&gt;
&lt;li&gt;Use the fence to find if a selected element is enclosed&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>