<?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 &amp;quot;Feature.setThread&amp;quot; function not working with NPT threads in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11989554#M23146</link>
    <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;Im trying to write a program that will automatically modifiy a part (hydraulic fluid port) depending on what type of port you want and what size (OSB, NPT, BSP, etc...) using iLogic. To modify the internal threads, im using the "feature.setThread" function, because the type of thread can change every time. The code runs fine for AINSI unified threads, but I cant get it to work with NPT threads. I always get this error message&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ilogic1.png" style="width: 399px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1219402i9B7F79C805B01791/image-size/large?v=v2&amp;amp;px=999" role="button" title="ilogic1.png" alt="ilogic1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;At the moment, the line of code responsible looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Feature&lt;/SPAN&gt;.&lt;SPAN&gt;SetThread&lt;/SPAN&gt;(&lt;SPAN&gt;"Thread2"&lt;/SPAN&gt;, &lt;SPAN&gt;"NPT"&lt;/SPAN&gt;,&lt;SPAN&gt;"1/4-18 NPT"&lt;/SPAN&gt;,&lt;SPAN&gt;""&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;I have tried using&amp;nbsp; "1/4", 1/4, "1/4 - 18",&amp;nbsp; and many other variations but nothing seems to work. I tried following the following recommendation:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ilogic2.png" style="width: 735px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1219403i79EC22E861F25828/image-size/large?v=v2&amp;amp;px=999" role="button" title="ilogic2.png" alt="ilogic2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So I use "" for the thread class but I have no idea what they mean my "use thread size instead of designation", since "1/4" doesn't work. Anybody has insight on how to use this functiuon with NPT threads? Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 25 May 2023 19:10:50 GMT</pubDate>
    <dc:creator>sdlF9MME</dc:creator>
    <dc:date>2023-05-25T19:10:50Z</dc:date>
    <item>
      <title>"Feature.setThread" function not working with NPT threads</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11989554#M23146</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;Im trying to write a program that will automatically modifiy a part (hydraulic fluid port) depending on what type of port you want and what size (OSB, NPT, BSP, etc...) using iLogic. To modify the internal threads, im using the "feature.setThread" function, because the type of thread can change every time. The code runs fine for AINSI unified threads, but I cant get it to work with NPT threads. I always get this error message&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ilogic1.png" style="width: 399px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1219402i9B7F79C805B01791/image-size/large?v=v2&amp;amp;px=999" role="button" title="ilogic1.png" alt="ilogic1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;At the moment, the line of code responsible looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Feature&lt;/SPAN&gt;.&lt;SPAN&gt;SetThread&lt;/SPAN&gt;(&lt;SPAN&gt;"Thread2"&lt;/SPAN&gt;, &lt;SPAN&gt;"NPT"&lt;/SPAN&gt;,&lt;SPAN&gt;"1/4-18 NPT"&lt;/SPAN&gt;,&lt;SPAN&gt;""&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;I have tried using&amp;nbsp; "1/4", 1/4, "1/4 - 18",&amp;nbsp; and many other variations but nothing seems to work. I tried following the following recommendation:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ilogic2.png" style="width: 735px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1219403i79EC22E861F25828/image-size/large?v=v2&amp;amp;px=999" role="button" title="ilogic2.png" alt="ilogic2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So I use "" for the thread class but I have no idea what they mean my "use thread size instead of designation", since "1/4" doesn't work. Anybody has insight on how to use this functiuon with NPT threads? Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 19:10:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11989554#M23146</guid>
      <dc:creator>sdlF9MME</dc:creator>
      <dc:date>2023-05-25T19:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: "Feature.setThread" function not working with NPT threads</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11990095#M23147</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3884551"&gt;@sdlF9MME&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you tried using capture snippet for this feature? Place a NPT thread feature and then in the ilogic editor find the feature and right click and add. The sequence of the designations might be out of order in your current code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 23:53:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11990095#M23147</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-05-25T23:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: "Feature.setThread" function not working with NPT threads</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11991469#M23148</link>
      <description>i used the snippet tool on the NPT feature in a separate part and it is exactly the same code in both cases. Only it works in one case but not on the other. Im thinking maybe it has something to do with the geometry of the part. Looking into it.</description>
      <pubDate>Fri, 26 May 2023 13:45:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11991469#M23148</guid>
      <dc:creator>sdlF9MME</dc:creator>
      <dc:date>2023-05-26T13:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: "Feature.setThread" function not working with NPT threads</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11994785#M23149</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3884551"&gt;@sdlF9MME&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have just tried this out and the Set Thread function is malfunctioning at least in Inv 2020. If you do not change the size away from what it is currently nothing happens. In this example the current size is 1/8 and I just want to change the thread type from&amp;nbsp;&lt;SPAN&gt;"NPT for PVC Pipe and Fitting" to "NPT". To achieve this I set the size to 1/4 then separately&amp;nbsp;back to 1/8&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Feature&lt;/SPAN&gt;.&lt;SPAN&gt;SetThread&lt;/SPAN&gt;(&lt;SPAN&gt;"Hole1"&lt;/SPAN&gt;, &lt;SPAN&gt;"NPT"&lt;/SPAN&gt;,&lt;SPAN&gt;"1/4"&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;)
&lt;SPAN&gt;Feature&lt;/SPAN&gt;.&lt;SPAN&gt;ThreadDesignation&lt;/SPAN&gt;(&lt;SPAN&gt;"Hole1"&lt;/SPAN&gt;) = &lt;SPAN&gt;"1/8"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And also it is failing changing from a straight like "ANSI Unified Thread" thread to a tapered thread. This isn't possible it seems with the current function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the API route which is more robust, See these links from the help section to define either the specific &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=HoleFeatures_CreateTaperedTapInfo" target="_blank" rel="noopener"&gt;tapered tap info&lt;/A&gt; or the more generic&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=HoleFeatures_CreateTapInfo" target="_blank" rel="noopener"&gt; hole tap info&lt;/A&gt; line and set the holefeature Tap Info.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;  Dim partDoc As PartDocument = ThisApplication.ActiveDocument

   Dim def As PartComponentDefinition = partDoc.ComponentDefinition

   ' Get the first thread feature
   Dim holeFeat As HoleFeature = def.Features.HoleFeatures("Hole1")

   ' Define the tapered tap information.
   'Dim tapInfo As TaperedThreadInfo = def.Features.HoleFeatures.CreateTaperedTapInfo(True, "NPT", "1/4")
   
   ' Define the generic tap information.
   Dim tapInfo As HoleTapInfo = def.Features.HoleFeatures.CreateTapInfo(True, "NPT", "1/8","",True,)
   
   ' Set the tap information.							
   holeFeat.TapInfo = tapInfo &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 May 2023 19:26:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11994785#M23149</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-05-28T19:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: "Feature.setThread" function not working with NPT threads</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11995975#M23150</link>
      <description>Trying your method right now. Will get back to you</description>
      <pubDate>Mon, 29 May 2023 12:22:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11995975#M23150</guid>
      <dc:creator>sdlF9MME</dc:creator>
      <dc:date>2023-05-29T12:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: "Feature.setThread" function not working with NPT threads</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11996203#M23151</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4427777"&gt;@chandra.shekar.g&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would it be possible to check the functionality of the ilogic "&lt;SPAN&gt;Feature&lt;/SPAN&gt;.&lt;SPAN&gt;SetThread" function? It seems to not be working all that great.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;The function fails to work if one of the two variables has allready been set.&amp;nbsp; Variables are change size or type.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;The function fails to work when changing type of thread from straight to taper.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;The API method work as expected.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 14:16:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11996203#M23151</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-05-29T14:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: "Feature.setThread" function not working with NPT threads</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11996604#M23152</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7946284"&gt;@A.Acheson&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please provide non confidential source iLogic code to investigate?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 17:36:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11996604#M23152</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2023-05-29T17:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: "Feature.setThread" function not working with NPT threads</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11997074#M23153</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4427777"&gt;@chandra.shekar.g&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response.&lt;/P&gt;&lt;P&gt;Step 1 place a holeand name Hole1 and set an initial straight thread of any size and type.&lt;/P&gt;&lt;P&gt;Step2. Set to tapered thread by running rule&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Feature&lt;/SPAN&gt;.&lt;SPAN&gt;SetThread&lt;/SPAN&gt;(&lt;SPAN&gt;"Hole1"&lt;/SPAN&gt;, &lt;SPAN&gt;"NPT"&lt;/SPAN&gt;,&lt;SPAN&gt;"1/4"&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;)&lt;BR /&gt;MessageBox.Show("Changing thread type"&lt;BR /&gt;&lt;SPAN&gt;Feature&lt;/SPAN&gt;.&lt;SPAN&gt;SetThread&lt;/SPAN&gt;(&lt;SPAN&gt;"Hole1"&lt;/SPAN&gt;, &lt;SPAN&gt;"NPT for PVC Pipe and Fitting"&lt;/SPAN&gt;,&lt;SPAN&gt;"1/4"&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;You will find an error changing from straight to tapered thread and if trying to change type with same size in the last line of the rule.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2023 00:02:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/quot-feature-setthread-quot-function-not-working-with-npt/m-p/11997074#M23153</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-05-30T00:02:00Z</dc:date>
    </item>
  </channel>
</rss>

