<?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 Macro stopped working in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/macro-stopped-working/m-p/5534737#M73510</link>
    <description>&lt;P&gt;I created this macro for ordering Architecture sheets in Revit 2015. When I&amp;nbsp;first created it there was no errors when i built it, and I was able to use the macro on a project. Now it is no longer working. The error is that 'i' does not exist in the current context. I have used the same structure for another macro for sheets, the only difference is that i am now using .StartsWith() instead of the string equaling a value. Can anyone help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;PRE&gt;	using(Transaction trans = new Transaction(doc, "Rename Sheets"))
				{
					FilteredElementCollector sheetView = new  FilteredElementCollector(doc).OfClass(typeof(ViewSheet));
					                                                                    
					trans.Start();
					
					foreach (Element e in sheetView)
					{
						try
						{
							ViewSheet Sheet = e as ViewSheet;
							
							{
								int i=0;
								i++;
									
								Parameter paramsheetlist = Sheet.LookupParameter("Sheet Number");
								string sheetOrders = paramsheetlist.AsString();
								
								if(sheetOrders.StartsWith("AD")){
									i=1;
								}else {
									i=2;}
								}
								Parameter paramArch = Sheet.LookupParameter("Sheet Order");
								paramArch.Set(i);
								
							}
						catch(Exception)
						{
						}
					}
					trans.Commit();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Mar 2015 13:30:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-03-10T13:30:24Z</dc:date>
    <item>
      <title>Macro stopped working</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/macro-stopped-working/m-p/5534737#M73510</link>
      <description>&lt;P&gt;I created this macro for ordering Architecture sheets in Revit 2015. When I&amp;nbsp;first created it there was no errors when i built it, and I was able to use the macro on a project. Now it is no longer working. The error is that 'i' does not exist in the current context. I have used the same structure for another macro for sheets, the only difference is that i am now using .StartsWith() instead of the string equaling a value. Can anyone help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;PRE&gt;	using(Transaction trans = new Transaction(doc, "Rename Sheets"))
				{
					FilteredElementCollector sheetView = new  FilteredElementCollector(doc).OfClass(typeof(ViewSheet));
					                                                                    
					trans.Start();
					
					foreach (Element e in sheetView)
					{
						try
						{
							ViewSheet Sheet = e as ViewSheet;
							
							{
								int i=0;
								i++;
									
								Parameter paramsheetlist = Sheet.LookupParameter("Sheet Number");
								string sheetOrders = paramsheetlist.AsString();
								
								if(sheetOrders.StartsWith("AD")){
									i=1;
								}else {
									i=2;}
								}
								Parameter paramArch = Sheet.LookupParameter("Sheet Order");
								paramArch.Set(i);
								
							}
						catch(Exception)
						{
						}
					}
					trans.Commit();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2015 13:30:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/macro-stopped-working/m-p/5534737#M73510</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-10T13:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro stopped working</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/macro-stopped-working/m-p/5535079#M73511</link>
      <description>&lt;P&gt;Oh, how I wish you did not use tabulators in your code &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Somehow you ended up withn&amp;nbsp;an extra curly&amp;nbsp;bracket&amp;nbsp;between the statements&amp;nbsp;&lt;STRONG&gt;i=2&lt;/STRONG&gt; and &lt;STRONG&gt;paramArch.Set(i)&lt;/STRONG&gt; . The latter statement&amp;nbsp;is outside of the scope of the &lt;STRONG&gt;i&lt;/STRONG&gt; variable. &amp;nbsp;(by the way, I suggest yo do not name your variables &lt;STRONG&gt;"i"&lt;/STRONG&gt;).&amp;nbsp;&lt;STRONG&gt;paramValue&lt;/STRONG&gt; woud read a lot nicer.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2015 16:13:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/macro-stopped-working/m-p/5535079#M73511</guid>
      <dc:creator>arnostlobel</dc:creator>
      <dc:date>2015-03-10T16:13:51Z</dc:date>
    </item>
  </channel>
</rss>

