<?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: Modifying Hole Feature in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modifying-hole-feature/m-p/10292231#M124128</link>
    <description>&lt;P&gt;Thank you. This code will be useful.&lt;/P&gt;</description>
    <pubDate>Wed, 05 May 2021 13:25:28 GMT</pubDate>
    <dc:creator>jkorson</dc:creator>
    <dc:date>2021-05-05T13:25:28Z</dc:date>
    <item>
      <title>Modifying Hole Feature</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modifying-hole-feature/m-p/10279085#M123942</link>
      <description>&lt;P&gt;Currently I have a part model that has counterbore holes. What I would like to do is easily switch the hole size from 1/4", #12, and #08 countersunk screws via iLogic. Can this be done?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is a picture. I highlighted what I want to change in the hole feature dialog.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Inventor 2022&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jkorson_0-1619714127258.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/913385i70B4BD205847EBA9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jkorson_0-1619714127258.png" alt="jkorson_0-1619714127258.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 16:40:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/modifying-hole-feature/m-p/10279085#M123942</guid>
      <dc:creator>jkorson</dc:creator>
      <dc:date>2021-04-29T16:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Hole Feature</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modifying-hole-feature/m-p/10282489#M123983</link>
      <description>&lt;P&gt;Yes, I believe this can be done, as long as you supply the correct corresponding string data, that matches what's in the spreadsheet it references for the other size.&amp;nbsp; It's in the &lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-F75C2560-E233-42F9-BCDA-B7F373692460" target="_blank" rel="noopener"&gt;HoleFeature's 'ClearanceInfo' property&lt;/A&gt;, which is a read/write property.&amp;nbsp; I don't recall if you can just change the data within the existing &lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-E330B9DC-29B8-430C-9B24-AA17B2BD7737" target="_blank" rel="noopener"&gt;HoleClearanceInfo&lt;/A&gt; object, or if you have to create a new HoleClearanceInfo object, then supply that in its place.&amp;nbsp; So, I'm showing both ways in the rule, with the new object process commented out for now.&lt;/P&gt;&lt;P&gt;Here is a fairly simple iLogic rule that attempts to change the specified fastener size for the clearance hole to fit.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oHoleFeats As HoleFeatures = oPDef.Features.HoleFeatures
Dim oHole As HoleFeature = oHoleFeats.Item(1)
'then either somethine like this:
If oHole.ClearanceInfo.FastenerSize = "#12" Then
	oHole.ClearanceInfo.FastenerSize = "#08"
End If
'or something like this:
'Dim oHCInfo As HoleClearanceInfo = oHoleFeats.CreateClearanceInfo("Ansi Unified Screw Threads", "Flat Head Machine Screw (82)", "#08", "Normal")
'oHole.ClearanceInfo = oHCInfo&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;If you want and have time, I would appreciate your Vote(s) for &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank"&gt;My IDEAS &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B166FEBB95D67CFA84899D32D8E17FC1/emoticons/1f4a1.png" alt=":light_bulb:" title=":light_bulb:" /&gt;&lt;/SPAN&gt;&lt;/A&gt;or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Apr 2021 18:56:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/modifying-hole-feature/m-p/10282489#M123983</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-04-30T18:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Hole Feature</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modifying-hole-feature/m-p/10288094#M124045</link>
      <description>&lt;P&gt;So how would I change to specifically call out a hole feature I want to change? For example I named my hole feature "LEFT SIDE FRONT FASCIA C-HOLE".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 21:32:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/modifying-hole-feature/m-p/10288094#M124045</guid>
      <dc:creator>jkorson</dc:creator>
      <dc:date>2021-05-03T21:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Hole Feature</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modifying-hole-feature/m-p/10289705#M124071</link>
      <description>&lt;P&gt;OK.&amp;nbsp; In this case, you can directly specify the hole feature's name within the Item() call, instead of its Index Integer.&amp;nbsp; Then, if it exists and the name is spelled correctly, it should recognize it and get it.&lt;/P&gt;&lt;P&gt;Also, I created a test part to test this code on my end, and determined that attempting to edit just the 'FastenerSize' string of the existing HoleClearanceInfo object won't work, but creating a new HoleClearanceInfo object, then setting that to the feature does work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In case you weren't aware, there is a spreadsheet document within your Design Data\XLS\en-US\ folder (that last sub-folder will coincide with your installed language pack), called "clearance.xls".&amp;nbsp; There is also another spreadsheet file in that folder called "thread.xls".&amp;nbsp; When you use the Hole command to create either a clearance hole, or a threaded hole, it references the corresponding spreadsheet file for the available settings.&amp;nbsp; When you want to specify a different setting, you have to make sure it matches something that exists within the spreadsheet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This variation of the code specifies the hole feature by its name, then without checking what the hole feature's current fastener size is set to, it creates a new info object, with each setting set the way you want it, then sets that info object in place of the hole feature's current info object.&amp;nbsp; This worked in my tests.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oHoleFeats As HoleFeatures = oPDef.Features.HoleFeatures
Dim oHole As HoleFeature = oHoleFeats.Item("LEFT SIDE FRONT FASCIA C-HOLE")
Dim oHCInfo As HoleClearanceInfo = oHoleFeats.CreateClearanceInfo("Ansi Unified Screw Threads", "Flat Head Machine Screw (82)", "#8", FastenerFitType.kNormalFitType)
oHole.ClearanceInfo = oHCInfo&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;If you want and have time, I would appreciate your Vote(s) for &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank"&gt;My IDEAS &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B166FEBB95D67CFA84899D32D8E17FC1/emoticons/1f4a1.png" alt=":light_bulb:" title=":light_bulb:" /&gt;&lt;/SPAN&gt;&lt;/A&gt;or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 14:03:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/modifying-hole-feature/m-p/10289705#M124071</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-05-04T14:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Hole Feature</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modifying-hole-feature/m-p/10292231#M124128</link>
      <description>&lt;P&gt;Thank you. This code will be useful.&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 13:25:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/modifying-hole-feature/m-p/10292231#M124128</guid>
      <dc:creator>jkorson</dc:creator>
      <dc:date>2021-05-05T13:25:28Z</dc:date>
    </item>
  </channel>
</rss>

