<?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 API get quantity of holes in threadnote in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-get-quantity-of-holes-in-threadnote/m-p/8247307#M84735</link>
    <description>&lt;P&gt;I'm looking to pull data from my drawing but I can't seem to find where the quantity value for the hole notes are stored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've made a reference to the dimension a HoleThreadNote, but the only quantity related items are HoleThreadNote.QuantityDefinition and HoleThreadNote.FormattedQuantityNote. Neither of these actually reference the number of holes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've looked through the WatchItems in the VBA window and can't seem to find which variables store the quantity either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Sep 2018 16:16:22 GMT</pubDate>
    <dc:creator>TA.Fehr</dc:creator>
    <dc:date>2018-09-05T16:16:22Z</dc:date>
    <item>
      <title>API get quantity of holes in threadnote</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-get-quantity-of-holes-in-threadnote/m-p/8247307#M84735</link>
      <description>&lt;P&gt;I'm looking to pull data from my drawing but I can't seem to find where the quantity value for the hole notes are stored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've made a reference to the dimension a HoleThreadNote, but the only quantity related items are HoleThreadNote.QuantityDefinition and HoleThreadNote.FormattedQuantityNote. Neither of these actually reference the number of holes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've looked through the WatchItems in the VBA window and can't seem to find which variables store the quantity either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 16:16:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-get-quantity-of-holes-in-threadnote/m-p/8247307#M84735</guid>
      <dc:creator>TA.Fehr</dc:creator>
      <dc:date>2018-09-05T16:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: API get quantity of holes in threadnote</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-get-quantity-of-holes-in-threadnote/m-p/8249849#M84736</link>
      <description>&lt;P&gt;I'm really stretching here. You can find the evaluated quantity in noteRef.Text.Text but that's the whole note. I did get this to work but it's super hackish...&lt;/P&gt;&lt;PRE&gt;Dim app As Inventor.Application = ThisApplication
Dim doc As DrawingDocument = app.ActiveDocument
Dim sh As Sheet = doc.Sheets.Item(1)
Dim oNote = sh.DrawingNotes.HoleThreadNotes.Item(1)
oNote.FormattedHoleThreadNote = "&amp;lt;QuantityNote/&amp;gt;"
MessageBox.Show(oNote.Text.Text, "Title")
undoDef = app.CommandManager.ControlDefinitions.Item("AppUndoCmd")
undoDef.Execute&lt;/PRE&gt;&lt;P&gt;I tried capturing the FormattedHoleThreadNote in a variable and changing it back to what I captured but that didn't work for some reason so I just run an undo to change the note back to what it was (super hackish)&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 13:34:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-get-quantity-of-holes-in-threadnote/m-p/8249849#M84736</guid>
      <dc:creator>clutsa</dc:creator>
      <dc:date>2018-09-06T13:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: API get quantity of holes in threadnote</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-get-quantity-of-holes-in-threadnote/m-p/8257600#M84737</link>
      <description>&lt;P&gt;Nice thinking outside the box.&lt;/P&gt;&lt;P&gt;Although I'm averse to any hack coding, I used your idea and created a new variable as a HoleThreadNote and copied the values over. Then when I renamed the "FormattedHoleThreadNote" to "&amp;lt;QuantityNote/&amp;gt;" the change does not affect the original component.&lt;/P&gt;&lt;P&gt;Nice simple and tidy, thanks for the direction&lt;/P&gt;&lt;P&gt;I've modified your code to better explain in case anyone in the future finds this thread&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim app As Inventor.Application = ThisApplication
Dim doc As DrawingDocument = app.ActiveDocument
Dim sh As Sheet = doc.Sheets.Item(1)
Dim oNote = sh.DrawingNotes.HoleThreadNotes.Item(1)
Dim oNote2 as HoleThreadNote = oNote
oNote2.FormattedHoleThreadNote = "&amp;lt;QuantityNote/&amp;gt;"
MessageBox.Show(Replace(oNote2.Text.Text, "X", ""), "Title")&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Sep 2018 16:33:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-get-quantity-of-holes-in-threadnote/m-p/8257600#M84737</guid>
      <dc:creator>TA.Fehr</dc:creator>
      <dc:date>2018-09-10T16:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: API get quantity of holes in threadnote</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-get-quantity-of-holes-in-threadnote/m-p/8257810#M84738</link>
      <description>&lt;P&gt;Spoke too soon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't notice that when I replaced the one holenote with another, the drawing still updated to the new holenote which means I effectively did nothing.&lt;/P&gt;&lt;P&gt;So my next though would be to save the formatted text in a string, perform the switch and then replace the formatted text with what I had saved. But for some reason it wouldn't reformat, it would convert it to only text.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So after about 30 minutes of head-scratching, I found that when I exported the formatted text from the holethreadnote, it exported it incorrectly (this would be Inventor's error as I compared what I was inputting to what Inventor exported and they were identical).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inventor exports this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;QuantityNote/&amp;gt;&amp;lt;StyleOverride Font='AIGDT' FontSize='0.2032'&amp;gt;n&amp;lt;/StyleOverride&amp;gt;&amp;lt;StyleOverride Font='Tahoma' FontSize='0.2032'&amp;gt;&amp;lt;HoleProperty HolePropertyID='kHoleDiameterHoleProperty' SetTolerances='False'&amp;gt;&amp;lt;/HoleProperty&amp;gt; &amp;lt;/StyleOverride&amp;gt;&amp;lt;StyleOverride Font='AIGDT' FontSize='0.2032'&amp;gt;x&amp;lt;/StyleOverride&amp;gt;&amp;lt;StyleOverride Font='Tahoma' FontSize='0.2032'&amp;gt; &amp;lt;HoleProperty HolePropertyID='kHoleDepthHoleProperty'False'&amp;gt;&amp;lt;/HoleProperty&amp;gt;&amp;lt;/StyleOverride&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The difference is that on the second hole property, the string&amp;nbsp;reads:&lt;/P&gt;&lt;PRE&gt;HolePropertyID='kHoleDepthHoleProperty'False'&amp;gt;&lt;/PRE&gt;&lt;P&gt;But the correct syntax is&lt;/P&gt;&lt;PRE&gt;HolePropertyID='kHoleDepthHoleProperty' SetTolerances='False'&amp;gt;&lt;/PRE&gt;&lt;P&gt;So I had to create a makeshift replace command which in all reality winds up being a bit more of a hack job than the undo command because it assumes this is the only error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; Dim SavedNote As String = oDim.FormattedHoleThreadNote
 oNote.FormattedHoleThreadNote = "&amp;lt;QuantityNote/&amp;gt;"
 Dim QTY As Integer = Replace(oNote.Text.Text, "X", "")
 SavedNote = Replace(SavedNote, "Property'False", "Property' SetTolerances='False")
 oNote.FormattedHoleThreadNote = SavedNote&lt;/PRE&gt;&lt;P&gt;So long story short,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5352440"&gt;@clutsa&lt;/a&gt;, your method, although slightly sacrilegious, is still a better method than what I came up with. I stand by my statement that this could be resolved by Inventor not exporting incorrect formatted notes in the first place.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 17:46:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-get-quantity-of-holes-in-threadnote/m-p/8257810#M84738</guid>
      <dc:creator>TA.Fehr</dc:creator>
      <dc:date>2018-09-10T17:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: API get quantity of holes in threadnote</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-get-quantity-of-holes-in-threadnote/m-p/10836989#M84739</link>
      <description>&lt;P&gt;your last code was broken, i fixed it and posted it here so that other people can see what you did:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim app As Inventor.Application = ThisApplication
Dim doc As DrawingDocument = app.ActiveDocument
Dim sh As Sheet = doc.Sheets.Item(1)
 Dim oNote = sh.DrawingNotes.HoleThreadNotes.Item(1)
 Dim SavedNote As String = oNote.FormattedHoleThreadNote
 oNote.FormattedHoleThreadNote = "&amp;lt;QuantityNote/&amp;gt;"
 Dim QTY As Integer = Replace(oNote.Text.Text, "X", "")
 SavedNote = Replace(SavedNote, "Property'False", "Property' SetTolerances='False")
 oNote.FormattedHoleThreadNote = SavedNote
InputBox(SavedNote)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Dec 2021 00:07:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-get-quantity-of-holes-in-threadnote/m-p/10836989#M84739</guid>
      <dc:creator>maxim.teleguz</dc:creator>
      <dc:date>2021-12-22T00:07:54Z</dc:date>
    </item>
  </channel>
</rss>

