<?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: Modify ThreadInfo using the API in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/modify-threadinfo-using-the-api/m-p/3005744#M140696</link>
    <description>&lt;P&gt;Below is a VBA code sample from API document:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub EditThread()

   Dim oDoc As PartDocument
   Set oDoc = ThisApplication.ActiveDocument

   Dim oDef As PartComponentDefinition
   Set oDef = oDoc.ComponentDefinition

   ' Create a new thread info object containing the thread data
   Dim oNewThreadInfo As StandardThreadInfo
   Set oNewThreadInfo = oDef.Features.ThreadFeatures.CreateStandardThreadInfo(False, True, "ISO Metric Profile", "M20x2.5", "6g")

   ' Get the first thread feature
   Dim oThread As ThreadFeature
   Set oThread = oDef.Features.ThreadFeatures.Item(1)

   ' Edit the thread feature
   oThread.ThreadInfo = oNewThreadInfo

End Sub&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Class argument is required, and below is the description for it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;FONT color="#993366"&gt;Class : Input String that defines the thread class. For example a valid class for an inch internal thread is 2B. A valid class for a metric external thread is 6g.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;FONT color="#993366"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;FONT color="#000000"&gt;Hope this helps.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Apr 2011 03:31:05 GMT</pubDate>
    <dc:creator>YuhanZhang</dc:creator>
    <dc:date>2011-04-28T03:31:05Z</dc:date>
    <item>
      <title>Modify ThreadInfo using the API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/modify-threadinfo-using-the-api/m-p/3004922#M140695</link>
      <description>&lt;P&gt;Would anyone have examples of how to modify ThreadInfo using the api.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently trying to use the code below to create a new ThreadInfo Object and assign it to the feature... but whenever the oClass is "" (zero length string)&amp;nbsp; the the CreateStandardThreadInfo fails.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;oThreadFeatures.Item(ThreadName).ThreadInfo = NewThreadInfo(oInternal, oRightHanded, oThreadType, oThreadDesignation, oClass)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Function&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; NewThreadInfo(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;ByVal&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; oInternal &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Boolean&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;ByVal&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; oRightHanded &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Boolean&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;ByVal&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; oThreadType &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;ByVal&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; oThreadDesignation &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;ByVal&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; oClass &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;ThreadInfo&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Try&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;NewThreadInfo = oThreadFeatures.CreateStandardThreadInfo(oInternal, oRightHanded, oThreadType, oThreadDesignation, oClass)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Catch&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; ex &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;Exception&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;.Show(ex.Message)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Try&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;Function&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2011 17:19:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/modify-threadinfo-using-the-api/m-p/3004922#M140695</guid>
      <dc:creator>guilloryt</dc:creator>
      <dc:date>2011-04-27T17:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: Modify ThreadInfo using the API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/modify-threadinfo-using-the-api/m-p/3005744#M140696</link>
      <description>&lt;P&gt;Below is a VBA code sample from API document:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub EditThread()

   Dim oDoc As PartDocument
   Set oDoc = ThisApplication.ActiveDocument

   Dim oDef As PartComponentDefinition
   Set oDef = oDoc.ComponentDefinition

   ' Create a new thread info object containing the thread data
   Dim oNewThreadInfo As StandardThreadInfo
   Set oNewThreadInfo = oDef.Features.ThreadFeatures.CreateStandardThreadInfo(False, True, "ISO Metric Profile", "M20x2.5", "6g")

   ' Get the first thread feature
   Dim oThread As ThreadFeature
   Set oThread = oDef.Features.ThreadFeatures.Item(1)

   ' Edit the thread feature
   oThread.ThreadInfo = oNewThreadInfo

End Sub&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Class argument is required, and below is the description for it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;FONT color="#993366"&gt;Class : Input String that defines the thread class. For example a valid class for an inch internal thread is 2B. A valid class for a metric external thread is 6g.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;FONT color="#993366"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="Element10"&gt;&lt;FONT color="#000000"&gt;Hope this helps.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2011 03:31:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/modify-threadinfo-using-the-api/m-p/3005744#M140696</guid>
      <dc:creator>YuhanZhang</dc:creator>
      <dc:date>2011-04-28T03:31:05Z</dc:date>
    </item>
  </channel>
</rss>

