<?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: C# - Loop with TextNote Type not working. in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/c-loop-with-textnote-type-not-working/m-p/3621104#M80459</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the problem is with the count in the loop. You should change the code to -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Setting the Variables&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; txtOPR = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"_"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] txtHgt = { &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"2.38mm (3/32in)"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"1.98mm (5/64in)"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;};&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] txtbkgd = { &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"Op"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"Tr"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;};&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//string txtType = (txtHgt[1] + txtOPR + txtbkgd[1]);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//int txtCount = txtHgt.Count;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;txtCount = 2;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;for&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;i = 0; i &amp;lt; txtCount; i++)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// for (int i = 0; i &amp;lt; list.Count; i++)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//string txtvar = list[i] as string;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Element num = textNote.TextNoteType.Duplicate(txtvar);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//TextNoteType noteType4 = num as TextNoteType;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;txtType = (txtHgt[i] + txtOPR + txtbkgd[i]);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Create a duplicate&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Element&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;ele = textNote.TextNoteType.Duplicate(txtType);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;TextNoteType&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; noteType = ele &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;TextNoteType&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Change font parameter&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;null&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;!= noteType)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Text Colour (only able to modify RGB Red)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;byte&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; valRed = 0; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Set colour to black&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//noteType.get_Parameter("Color").Set(4);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;noteType.get_Parameter(&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"Color"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;).Set(valRed);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Text Line Weight 1-16&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;noteType.get_Parameter(&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"Line Weight"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;).Set(2);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;trans.Commit();&lt;/P&gt;
&lt;P&gt;...''&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After the above changes, I can see both the textnote types created:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/37532i36637F3824AA3AA4/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="textnotetype.png" title="textnotetype.png" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;cheers&lt;/P&gt;</description>
    <pubDate>Fri, 14 Sep 2012 20:55:08 GMT</pubDate>
    <dc:creator>saikat</dc:creator>
    <dc:date>2012-09-14T20:55:08Z</dc:date>
    <item>
      <title>C# - Loop with TextNote Type not working.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/c-loop-with-textnote-type-not-working/m-p/3615902#M80458</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working on a simple add-in that creates a bunch of text styles in a project or family in Revit 2013.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm able to only duplicate and add 1 text type and modify it's text parameters.&amp;nbsp; I'm trying to figure out how to loop it based on an array count.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to count &amp;amp; loop depending the the array count for "txtHgt".&lt;/P&gt;&lt;P&gt;But I cannot add a variable counter to "noteType" which is a TextNoteType and this is causing the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;                // Action Code Starts Here
                Document doc = commandData.Application.ActiveUIDocument.Document;

                /// Retrieve access to all TextNote Elements
                FilteredElementCollector collectorUsed

                  = new FilteredElementCollector(doc);

                ICollection&amp;lt;ElementId&amp;gt; textNotes
                  = collectorUsed.OfClass(typeof(TextNote))
                    .ToElementIds();

                foreach (ElementId textNoteid in textNotes)
                {
                    TextNote textNote = doc.GetElement(
                      textNoteid) as TextNote;
                  
                    Transaction trans = new Transaction(doc);
                    trans.Start("ChangeParam");

                    //Setting the Variables
                    string txtOPR = "_";
                    string[] txtHgt = { "2.38mm (3/32in)", "1.98mm (5/64in)" };
                    string[] txtbkgd = { "Op", "Tr" };
                    //string txtType = (txtHgt[1] + txtOPR + txtbkgd[1]);
                    //int txtCount = txtHgt.Count;
                    int txtCount = 1;

                    for (int i = 0; i &amp;lt; txtCount; i++)
                       // for (int i = 0; i &amp;lt; list.Count; i++)
                    {
                        //string txtvar = list[i] as string;
                        //Element num = textNote.TextNoteType.Duplicate(txtvar);
                        //TextNoteType noteType4 = num as TextNoteType;

                        string txtType = (txtHgt[i] + txtOPR + txtbkgd[1]);


                        // Create a duplicate
                        Element ele = textNote.TextNoteType.Duplicate(txtType);
                        TextNoteType noteType = ele as TextNoteType;

                        // Change font parameter
                        if (null != noteType)
                        {
                            // Text Colour (only able to modify RGB Red)
                            byte valRed = 0; //Set colour to black
                            //noteType.get_Parameter("Color").Set(4);
                            noteType.get_Parameter("Color").Set(valRed);
                            // Text Line Weight 1-16
                            noteType.get_Parameter("Line Weight").Set(2);
                        }
                    }
                    trans.Commit();
                }
                // Return Success&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any Suggestions?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2012 05:18:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/c-loop-with-textnote-type-not-working/m-p/3615902#M80458</guid>
      <dc:creator>mfleming.stantec</dc:creator>
      <dc:date>2012-09-12T05:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: C# - Loop with TextNote Type not working.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/c-loop-with-textnote-type-not-working/m-p/3621104#M80459</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the problem is with the count in the loop. You should change the code to -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Setting the Variables&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; txtOPR = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"_"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] txtHgt = { &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"2.38mm (3/32in)"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"1.98mm (5/64in)"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;};&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] txtbkgd = { &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"Op"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"Tr"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;};&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//string txtType = (txtHgt[1] + txtOPR + txtbkgd[1]);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//int txtCount = txtHgt.Count;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;txtCount = 2;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;for&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;i = 0; i &amp;lt; txtCount; i++)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// for (int i = 0; i &amp;lt; list.Count; i++)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//string txtvar = list[i] as string;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Element num = textNote.TextNoteType.Duplicate(txtvar);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//TextNoteType noteType4 = num as TextNoteType;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;txtType = (txtHgt[i] + txtOPR + txtbkgd[i]);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Create a duplicate&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Element&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;ele = textNote.TextNoteType.Duplicate(txtType);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;TextNoteType&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; noteType = ele &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;TextNoteType&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Change font parameter&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;null&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;!= noteType)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Text Colour (only able to modify RGB Red)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;byte&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; valRed = 0; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Set colour to black&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//noteType.get_Parameter("Color").Set(4);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;noteType.get_Parameter(&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"Color"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;).Set(valRed);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Text Line Weight 1-16&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;noteType.get_Parameter(&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"Line Weight"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;).Set(2);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;trans.Commit();&lt;/P&gt;
&lt;P&gt;...''&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After the above changes, I can see both the textnote types created:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/37532i36637F3824AA3AA4/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="textnotetype.png" title="textnotetype.png" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;cheers&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2012 20:55:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/c-loop-with-textnote-type-not-working/m-p/3621104#M80459</guid>
      <dc:creator>saikat</dc:creator>
      <dc:date>2012-09-14T20:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: C# - Loop with TextNote Type not working.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/c-loop-with-textnote-type-not-working/m-p/3621330#M80460</link>
      <description>&lt;P&gt;The loop is now working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to adjust the loop count based on the number of possible text sizes.&lt;/P&gt;&lt;P&gt;I'm using the following:&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Setting the Variables&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string txtOPR = "_";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string[] txtHgt = { "1.58mm (1/16in)", "1.98mm (5/64in)", "2.38mm (3/32in)", "3.17mm (1/8in)", "4.76mm (3/16in)", "6.35mm (1/4in)", "12.7mm (1/2in)" };&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string[] txtbkgd = { "Op", "Tr" };&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int txtCount = txtHgt.Length * txtbkgd.Length;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Which works fine.&lt;/P&gt;&lt;P&gt;The next part is changeing the txtType "string value based on the specific location of the count.&lt;/P&gt;&lt;P&gt;I want to be ablt to change the entered Text Style Type Name after I have completed all possible values for txtHgt &amp;amp; txtbkgd[0].&amp;nbsp; After I enter those, I want to enter txtHgt &amp;amp; txtBkgd[1].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the following statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;                    for (int i = 0; i &amp;lt; txtCount; i++)
                    {
                        if (i &amp;lt;= txtHgt.Length)
                        {
                            string txtType = (txtHgt[i] + txtOPR + txtbkgd[0]);
                        }
                        else
                        {
                            string txtType = (txtHgt[i] + txtOPR + txtbkgd[1]);
                        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The name 'txtType' does not exist in the current context Error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which is saying it's outside the current scope or not defined.&lt;/P&gt;&lt;P&gt;What am I missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Sep 2012 07:19:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/c-loop-with-textnote-type-not-working/m-p/3621330#M80460</guid>
      <dc:creator>mfleming.stantec</dc:creator>
      <dc:date>2012-09-15T07:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: C# - Loop with TextNote Type not working.</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/c-loop-with-textnote-type-not-working/m-p/3621628#M80461</link>
      <description>&lt;P&gt;I have completed the project.&lt;/P&gt;&lt;P&gt;Not 100% clean, but it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had to add some if statements to check for values and increase array values as needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Completed code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using System;
using System.Collections.Generic;
using System.Collections;
using System.Windows.Forms;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System.Text;
using System.Linq;

namespace CreateTextType
{
    [Transaction(TransactionMode.Manual)]
    public class cmdTextType : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData,
                                ref string message,
                                ElementSet elements)
        {
            try
            {
                // Action Code Starts Here
                Document doc = commandData.Application.ActiveUIDocument.Document;

                /// Retrieve access to all TextNote Elements
                FilteredElementCollector collectorUsed

                  = new FilteredElementCollector(doc);

                ICollection&amp;lt;ElementId&amp;gt; textNotes
                  = collectorUsed.OfClass(typeof(TextNote))
                    .ToElementIds();

                foreach (ElementId textNoteid in textNotes)
                {
                    TextNote textNote = doc.GetElement(
                      textNoteid) as TextNote;
                  
                    Transaction trans = new Transaction(doc);
                    trans.Start("ChangeParam");

                    //Setting the Variables
                    string txtOPR = "_";
                    string[] txtHgt = { "1.58mm (1/16in)", "1.98mm (5/64in)", "2.38mm (3/32in)", "3.17mm (1/8in)", "4.76mm (3/16in)", "6.35mm (1/4in)", "12.7mm (1/2in)" };
                    string[] txtbkgd = { "Op", "Tr"};
                    int bkgCount = 0;

                    int txtCount = txtHgt.Length * txtbkgd.Length;
                  
                    for (int i = 0; i &amp;lt; txtCount; i++)
                    {
                        if (i &amp;lt; txtHgt.Length &amp;amp;&amp;amp; bkgCount == 0)
                        {
                            bkgCount = 0;
                        }
                        else
                        {
                            if (bkgCount == 0)
                            {
                                i = 0;
                            }
                            bkgCount = 1;
                            if (i == txtHgt.Length &amp;amp;&amp;amp; bkgCount == 1)
                            {
                                //break;
                                goto IfDone;
                            }
                        }
                    
                        string txtType = (txtHgt[i] + txtOPR + txtbkgd[bkgCount]);

                        // Create a duplicate
                        Element ele = textNote.TextNoteType.Duplicate(txtType);
                        TextNoteType noteType = ele as TextNoteType;


                        // Change font parameter
                        if (null != noteType)
                        {
                            noteType.get_Parameter("Text Size").Set((3.0 / 32.0) * (1.0 / 12.0));
                            // Text Tab Size for 3/32" = (3.0 / 32.0) * (1.0 / 12.0)



                        }
                    }
                    IfDone:
                    trans.Commit();
                }
                // Return Success
                return Result.Succeeded;

            }
            catch (Exception ex)
            {

                // Failure Message
                message = ex.Message;
                return Result.Failed;

            }
        }
    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Sep 2012 05:14:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/c-loop-with-textnote-type-not-working/m-p/3621628#M80461</guid>
      <dc:creator>mfleming.stantec</dc:creator>
      <dc:date>2012-09-16T05:14:52Z</dc:date>
    </item>
  </channel>
</rss>

