<?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: Drawing file - how to identify a TextBox with unique Id or by name in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/3948250#M130448</link>
    <description>&lt;P&gt;I've added attributes to mine.&amp;nbsp; These are a bit like hidden&amp;nbsp;iProperties for objects in Inventor:&lt;/P&gt;&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/manufacturing/2013/01/inventor-set-attributes-through-api.html" target="_blank"&gt;http://adndevblog.typepad.com/manufacturing/2013/01/inventor-set-attributes-through-api.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By adding them you can search for attributes of a certain name or value then use them to select the associated object.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2013 07:23:43 GMT</pubDate>
    <dc:creator>ChrisAtherton</dc:creator>
    <dc:date>2013-06-06T07:23:43Z</dc:date>
    <item>
      <title>Drawing file - how to identify a TextBox with unique Id or by name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/3947607#M130447</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The TextBoxes don't have a Name property or an UniqueIdentifier property. &amp;nbsp;So, I don't know how to find a specified TextBox.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to add a XML comment by code in the FormattedText property and got an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone know a solution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pascal&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2013 16:01:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/3947607#M130447</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-06-05T16:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing file - how to identify a TextBox with unique Id or by name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/3948250#M130448</link>
      <description>&lt;P&gt;I've added attributes to mine.&amp;nbsp; These are a bit like hidden&amp;nbsp;iProperties for objects in Inventor:&lt;/P&gt;&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/manufacturing/2013/01/inventor-set-attributes-through-api.html" target="_blank"&gt;http://adndevblog.typepad.com/manufacturing/2013/01/inventor-set-attributes-through-api.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By adding them you can search for attributes of a certain name or value then use them to select the associated object.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2013 07:23:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/3948250#M130448</guid>
      <dc:creator>ChrisAtherton</dc:creator>
      <dc:date>2013-06-06T07:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing file - how to identify a TextBox with unique Id or by name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/3948416#M130449</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Attributes are lovely aren't they? &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2013 12:19:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/3948416#M130449</guid>
      <dc:creator>jdkriek</dc:creator>
      <dc:date>2013-06-06T12:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing file - how to identify a TextBox with unique Id or by name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/4295366#M130450</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to add an AttributeSet (AttributeSets.Count = 1)&amp;nbsp;&lt;SPAN&gt;but, when I edit the sketch the count is 0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What I doing wrong?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Pascal&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2013 16:39:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/4295366#M130450</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-06-11T16:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing file - how to identify a TextBox with unique Id or by name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/4307153#M130451</link>
      <description>&lt;P&gt;Hi &lt;SPAN&gt;Pascal,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Which object you added the attribute? Are you sure it was Sketch? Please provide a small demo on what you are doing. It will help to know what happened.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2013 03:56:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/4307153#M130451</guid>
      <dc:creator>xiaodong_liang</dc:creator>
      <dc:date>2013-06-24T03:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing file - how to identify a TextBox with unique Id or by name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/4308611#M130452</link>
      <description>&lt;P&gt;Hi Xiaodong,&lt;/P&gt;&lt;P&gt;Here's a little C# demo that reproduces the problem. &amp;nbsp;I tried to send you the complete solution (in a .zip file) but I get an error: "The file is corrupted. &amp;nbsp;Please update a valid file". &amp;nbsp;So, I attach a .txt file that represent the Program.cs file.&lt;/P&gt;&lt;P&gt;Before starting, you must create a new drawing with a TitleBlockDefinition that must include one text box.&lt;/P&gt;&lt;P&gt;The demo use the first TitleBlockDefinition in the active drawing document and showing the count of AttributeSet of the first TextBox.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the result:&lt;/P&gt;&lt;P&gt;&lt;IMG border="0" src="https://forums.autodesk.com/t5/image/serverpage/image-id/54953i526402F079A97464/image-size/original?v=mpbl-1&amp;amp;px=-1" align="center" title="Result.jpg" alt="Result.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pascal Langlais&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2013 14:07:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/4308611#M130452</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-06-25T14:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing file - how to identify a TextBox with unique Id or by name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/4319790#M130453</link>
      <description>&lt;P&gt;Hi Pascal,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2 things:&lt;/P&gt;
&lt;P&gt;1) Sketch editing of title block definition, i.e. Edit() / ExitEdit(), seems to rely on a copy of the sketch, so you would need to add the attribute set with CopyWithOwner = True&lt;/P&gt;
&lt;P&gt;2) All sketch editing of the title block definition should be done inside an Edit() / ExitEdit() section including modifying the attributes of a text box inside the sketch&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once I followed the above the attributes remained in tact:&lt;/P&gt;
&lt;PRE&gt;static void test()
{
  Application = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application") as Inventor.Application;

  if (Application.ActiveDocument == null)
    Console.WriteLine("There is no active document in Inventor.");
  else
    if (!(Application.ActiveDocument is DrawingDocument))
      Console.WriteLine("Active document should be a drawing document.");
    else
    {
      // Get active drawing document
      Document = Application.ActiveDocument as DrawingDocument;

      // Get ANSI large title block definition 
      TitleBlockDefinitions titleBlockDefinitions = Document.TitleBlockDefinitions;
      TitleBlockDefinition titleBlockDef1 = titleBlockDefinitions[1];

      // Show counts of attribute set and attribute (should be 0)
      TextBox textBox = titleBlockDef1.Sketch.TextBoxes[1];
      Console.WriteLine("AttributeSets.Count =&amp;gt; " + textBox.AttributeSets.Count.ToString() + " , Expected = 0 (Before creating)");

      ///////////////////////////////////////////////////////////////////
      // Real modification, adding the Attribute set
      ///////////////////////////////////////////////////////////////////

      // Edit sketch
      DrawingSketch sketch;
      titleBlockDef1.Edit(out sketch);

      // Add Attribute set and attribute
      textBox = sketch.TextBoxes[1]; 
      AttributeSet myAttributeSet = textBox.AttributeSets.Add("MySet", true);
      Inventor.Attribute myAttribute = myAttributeSet.Add("MyAttribute", ValueTypeEnum.kStringType, "MyAttributeValue");

      // Exit sketch with saving
      titleBlockDef1.ExitEdit(true);

      // Show counts of attribute set and attribute (should be 1)
      textBox = titleBlockDef1.Sketch.TextBoxes[1];
      Console.WriteLine("AttributeSets.Count =&amp;gt; " + textBox.AttributeSets.Count.ToString() + " , Expected = 1 (After creating, before editing sketch)");

      ///////////////////////////////////////////////////////////////////
      // Fake modification, just for testing that the Attribute remains
      ///////////////////////////////////////////////////////////////////

      //DrawingSketch sketch;
      titleBlockDef1.Edit(out sketch);

      // Exit sketch with saving
      titleBlockDef1.ExitEdit(true);

      // Show counts (ERROR USED TO BE HERE =&amp;gt; should be 1 but previously showed 0)
      textBox = titleBlockDef1.Sketch.TextBoxes[1];
      Console.WriteLine("AttributeSets.Count =&amp;gt; " + textBox.AttributeSets.Count.ToString() + " , Expected = 1 (After ExitEdit)");
      Console.ReadKey();
    }
}&lt;/PRE&gt;
&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2013 19:21:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/4319790#M130453</guid>
      <dc:creator>adam.nagy</dc:creator>
      <dc:date>2013-07-04T19:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing file - how to identify a TextBox with unique Id or by name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/4319802#M130454</link>
      <description>&lt;P&gt;Hi Adam,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your explanations, it seems logical.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Leaving on holidays now but I will have a look at your solution upon my return.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pascal&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2013 19:27:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/drawing-file-how-to-identify-a-textbox-with-unique-id-or-by-name/m-p/4319802#M130454</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-04T19:27:40Z</dc:date>
    </item>
  </channel>
</rss>

