<?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 Re: Hole Feature and shared Sketch. VB and C# disagree in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/hole-feature-and-shared-sketch-vb-and-c-disagree/m-p/11119922#M137066</link>
    <description>&lt;P&gt;Can you share VB and C# code?&lt;/P&gt;</description>
    <pubDate>Thu, 21 Apr 2022 15:35:52 GMT</pubDate>
    <dc:creator>Zach.Stauffer</dc:creator>
    <dc:date>2022-04-21T15:35:52Z</dc:date>
    <item>
      <title>Hole Feature and shared Sketch. VB and C# disagree</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/hole-feature-and-shared-sketch-vb-and-c-disagree/m-p/11118612#M137033</link>
      <description>&lt;P class="lia-align-left"&gt;Hello,&lt;BR /&gt;I trying to get Sketch Definition from Hole Feature.&lt;/P&gt;&lt;P class="lia-align-left"&gt;Considering that it is the same document:&lt;/P&gt;&lt;P class="lia-align-left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-left"&gt;VB:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mirkomaga_0-1650523286064.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1057306iF0DEC35A43E341D3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mirkomaga_0-1650523286064.png" alt="mirkomaga_0-1650523286064.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Addin c#:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mirkomaga_1-1650523390172.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1057308iBCC0869CE46E5D3A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mirkomaga_1-1650523390172.png" alt="mirkomaga_1-1650523390172.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can well see:&amp;nbsp;in the second image the sketch throw me an exception that is not there in the first one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is Model, anyone have the same problem?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mirkomaga_2-1650523529902.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1057309iBEF43480CE4D4E63/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mirkomaga_2-1650523529902.png" alt="mirkomaga_2-1650523529902.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 06:50:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/hole-feature-and-shared-sketch-vb-and-c-disagree/m-p/11118612#M137033</guid>
      <dc:creator>mirkomaga</dc:creator>
      <dc:date>2022-04-21T06:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Hole Feature and shared Sketch. VB and C# disagree</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/hole-feature-and-shared-sketch-vb-and-c-disagree/m-p/11119922#M137066</link>
      <description>&lt;P&gt;Can you share VB and C# code?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 15:35:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/hole-feature-and-shared-sketch-vb-and-c-disagree/m-p/11119922#M137066</guid>
      <dc:creator>Zach.Stauffer</dc:creator>
      <dc:date>2022-04-21T15:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Hole Feature and shared Sketch. VB and C# disagree</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/hole-feature-and-shared-sketch-vb-and-c-disagree/m-p/11123638#M137157</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11566974"&gt;@mirkomaga&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have created C# code for the same and it's working fine for me. See attached images.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Test_4.png" style="width: 166px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1058422iCED5D08166EBB609/image-dimensions/166x322?v=v2" width="166" height="322" role="button" title="Test_4.png" alt="Test_4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SketchName_1.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1058425iC0B0BF3E84364602/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SketchName_1.png" alt="SketchName_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;BR /&gt;Here is the C# code. It's console Application code. And note that Inventor application as well as Part is open when you test it.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Inventor.Application inventorApplication = (Inventor.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application");

PartDocument partDocument = (PartDocument)inventorApplication.ActiveDocument;
PartComponentDefinition partComponentDefinition =partDocument.ComponentDefinition;

foreach (PartFeature partfeature in partComponentDefinition.Features)
{
  if (partfeature.Type == ObjectTypeEnum.kHoleFeatureObject)
  {
    HoleFeature holeFeature = (HoleFeature)partfeature;
    Console.WriteLine(holeFeature.Sketch.Name);
   }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Jatin Devaiya&lt;BR /&gt;&lt;BR /&gt;Accept it as solution.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2022 05:49:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/hole-feature-and-shared-sketch-vb-and-c-disagree/m-p/11123638#M137157</guid>
      <dc:creator>jatindevaiya08</dc:creator>
      <dc:date>2022-04-23T05:49:50Z</dc:date>
    </item>
  </channel>
</rss>

