<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Find Matching Surface in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-matching-surface/m-p/11477885#M143768</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm taking a system com object "Entity" from the assembly level. I'm then opening up the part document and within the part document. I'm trying to find the corresponding surface for "Entity". Currently I'm evaluating the surface areas. The issue is there are multiple surfaces with the same area. And its mixing them up. Is there a better way to find the matching surface for "Entity"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"face&lt;/SPAN&gt;.&lt;SPAN&gt;Evaluator&lt;/SPAN&gt;.&lt;SPAN&gt;Area&lt;/SPAN&gt; = &lt;SPAN&gt;Entity&lt;/SPAN&gt;.&lt;SPAN&gt;Evaluator&lt;/SPAN&gt;.&lt;SPAN&gt;Area"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;NameEntity&lt;/SPAN&gt;(&lt;SPAN&gt;Entity&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt;, &lt;SPAN&gt;Name&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;FaceEval&lt;/SPAN&gt; = &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;SurfaceBodies&lt;/SPAN&gt;.
    &lt;SPAN&gt;Cast&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;SurfaceBody&lt;/SPAN&gt;).
    &lt;SPAN&gt;SelectMany&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt;)(&lt;SPAN&gt;Function&lt;/SPAN&gt;(&lt;SPAN&gt;f&lt;/SPAN&gt;) &lt;SPAN&gt;f&lt;/SPAN&gt;.&lt;SPAN&gt;Faces&lt;/SPAN&gt;.&lt;SPAN&gt;Cast&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt;)).
    &lt;SPAN&gt;Aggregate&lt;/SPAN&gt;(&lt;SPAN&gt;Function&lt;/SPAN&gt;(&lt;SPAN&gt;face&lt;/SPAN&gt;, &lt;SPAN&gt;nextFace&lt;/SPAN&gt;) &lt;SPAN&gt;If&lt;/SPAN&gt;(&lt;SPAN&gt;face&lt;/SPAN&gt;.&lt;SPAN&gt;Evaluator&lt;/SPAN&gt;.&lt;SPAN&gt;Area&lt;/SPAN&gt; = &lt;SPAN&gt;Entity&lt;/SPAN&gt;.&lt;SPAN&gt;Evaluator&lt;/SPAN&gt;.&lt;SPAN&gt;Area&lt;/SPAN&gt;, &lt;SPAN&gt;face&lt;/SPAN&gt;, &lt;SPAN&gt;nextFace&lt;/SPAN&gt;))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Oct 2022 15:06:44 GMT</pubDate>
    <dc:creator>ndillner343SKL</dc:creator>
    <dc:date>2022-10-12T15:06:44Z</dc:date>
    <item>
      <title>Find Matching Surface</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-matching-surface/m-p/11477885#M143768</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm taking a system com object "Entity" from the assembly level. I'm then opening up the part document and within the part document. I'm trying to find the corresponding surface for "Entity". Currently I'm evaluating the surface areas. The issue is there are multiple surfaces with the same area. And its mixing them up. Is there a better way to find the matching surface for "Entity"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"face&lt;/SPAN&gt;.&lt;SPAN&gt;Evaluator&lt;/SPAN&gt;.&lt;SPAN&gt;Area&lt;/SPAN&gt; = &lt;SPAN&gt;Entity&lt;/SPAN&gt;.&lt;SPAN&gt;Evaluator&lt;/SPAN&gt;.&lt;SPAN&gt;Area"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;NameEntity&lt;/SPAN&gt;(&lt;SPAN&gt;Entity&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt;, &lt;SPAN&gt;Name&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;FaceEval&lt;/SPAN&gt; = &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;SurfaceBodies&lt;/SPAN&gt;.
    &lt;SPAN&gt;Cast&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;SurfaceBody&lt;/SPAN&gt;).
    &lt;SPAN&gt;SelectMany&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt;)(&lt;SPAN&gt;Function&lt;/SPAN&gt;(&lt;SPAN&gt;f&lt;/SPAN&gt;) &lt;SPAN&gt;f&lt;/SPAN&gt;.&lt;SPAN&gt;Faces&lt;/SPAN&gt;.&lt;SPAN&gt;Cast&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt;)).
    &lt;SPAN&gt;Aggregate&lt;/SPAN&gt;(&lt;SPAN&gt;Function&lt;/SPAN&gt;(&lt;SPAN&gt;face&lt;/SPAN&gt;, &lt;SPAN&gt;nextFace&lt;/SPAN&gt;) &lt;SPAN&gt;If&lt;/SPAN&gt;(&lt;SPAN&gt;face&lt;/SPAN&gt;.&lt;SPAN&gt;Evaluator&lt;/SPAN&gt;.&lt;SPAN&gt;Area&lt;/SPAN&gt; = &lt;SPAN&gt;Entity&lt;/SPAN&gt;.&lt;SPAN&gt;Evaluator&lt;/SPAN&gt;.&lt;SPAN&gt;Area&lt;/SPAN&gt;, &lt;SPAN&gt;face&lt;/SPAN&gt;, &lt;SPAN&gt;nextFace&lt;/SPAN&gt;))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 15:06:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-matching-surface/m-p/11477885#M143768</guid>
      <dc:creator>ndillner343SKL</dc:creator>
      <dc:date>2022-10-12T15:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Find Matching Surface</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-matching-surface/m-p/11478049#M143772</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11442738"&gt;@ndillner343SKL&lt;/a&gt;.&amp;nbsp; One thing you could try would be to use 'Is' instead of '=', then just compare the Face object directly to the Entity object.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;If face Is Entity&lt;/LI-CODE&gt;
&lt;P&gt;The next thing you could try, if it is a Face, is the Face.IntenalName property.&amp;nbsp; If those two match, then you have the same Face.&amp;nbsp; However, the Edge object does not have an 'InternalName' property, so it would not work for all possible types of entities.&amp;nbsp; Beyond that, the next step is a bit more complex, but you could try using the GetReferenceKey method, which all 3 usual objects (Face, Edge, Vertex) have.&amp;nbsp; Then you would also need to work with the Document.ReferenceKeyManager object, and its methods to compare the two results.&amp;nbsp; I have not used that process that much, but you can find examples of its use here on this forum.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 16:02:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-matching-surface/m-p/11478049#M143772</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-10-12T16:02:22Z</dc:date>
    </item>
  </channel>
</rss>

