<?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 Interior elevation rename in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7402994#M55902</link>
    <description>&lt;P&gt;I am working on a routine to rename my interior elevations that is based on room information. Right now it is supposed to update all elevations but it does not appear to do anything. I eventually would like to make this routine only update selected elevation(s).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;		public void renameelevation()
		{
			Document doc = this.Document;
			string newvname="";
	
			using(Transaction tr = new Transaction(doc, "Rename Elevations"))
			{
				
				FilteredElementCollector collector= new FilteredElementCollector( doc ).OfClass( typeof(ViewSection ) );			  
				
				tr.Start();
				{
				foreach(Element E in collector )
				{
					try
					{ 
						ViewSection current= E as ViewSection;
						{
						int value=0;
						value++;
						// Construct a point at the midpoint of the 
						// front bottom edge of the elev view cropbox
						
						double xmax = current.CropBox.Max.X;
						double xmin = current.CropBox.Min.X;
						double zmax = current.CropBox.Max.Z;
						
						XYZ pt = new XYZ(
						xmax - 0.5 * ( xmax - xmin ),
						1.0,
						zmax);
						
						
						// Get pt's translation to 
						// project coordinate system
						
						pt = current.CropBox.Transform.OfPoint( pt );
						
						Autodesk.Revit.DB.Architecture.Room rm
						= doc.GetRoomAtPoint( pt );
							if (null != rm)
							{
							string x = value.ToString();
							string combinedName= "EI-"+rm.Number+x;
							
							current.Name = combinedName;
							
							newvname += combinedName + "\n";
							}
						}
					}
					catch(Exception)
					{
					}
				}
				}
				tr.Commit();
			}
			
		}&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 22 Sep 2017 22:37:38 GMT</pubDate>
    <dc:creator>will.wydock</dc:creator>
    <dc:date>2017-09-22T22:37:38Z</dc:date>
    <item>
      <title>Interior elevation rename</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7402994#M55902</link>
      <description>&lt;P&gt;I am working on a routine to rename my interior elevations that is based on room information. Right now it is supposed to update all elevations but it does not appear to do anything. I eventually would like to make this routine only update selected elevation(s).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;		public void renameelevation()
		{
			Document doc = this.Document;
			string newvname="";
	
			using(Transaction tr = new Transaction(doc, "Rename Elevations"))
			{
				
				FilteredElementCollector collector= new FilteredElementCollector( doc ).OfClass( typeof(ViewSection ) );			  
				
				tr.Start();
				{
				foreach(Element E in collector )
				{
					try
					{ 
						ViewSection current= E as ViewSection;
						{
						int value=0;
						value++;
						// Construct a point at the midpoint of the 
						// front bottom edge of the elev view cropbox
						
						double xmax = current.CropBox.Max.X;
						double xmin = current.CropBox.Min.X;
						double zmax = current.CropBox.Max.Z;
						
						XYZ pt = new XYZ(
						xmax - 0.5 * ( xmax - xmin ),
						1.0,
						zmax);
						
						
						// Get pt's translation to 
						// project coordinate system
						
						pt = current.CropBox.Transform.OfPoint( pt );
						
						Autodesk.Revit.DB.Architecture.Room rm
						= doc.GetRoomAtPoint( pt );
							if (null != rm)
							{
							string x = value.ToString();
							string combinedName= "EI-"+rm.Number+x;
							
							current.Name = combinedName;
							
							newvname += combinedName + "\n";
							}
						}
					}
					catch(Exception)
					{
					}
				}
				}
				tr.Commit();
			}
			
		}&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 22:37:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7402994#M55902</guid>
      <dc:creator>will.wydock</dc:creator>
      <dc:date>2017-09-22T22:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Interior elevation rename</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7405998#M55903</link>
      <description>&lt;P&gt;Maybe you have to use another overload to find the room&amp;nbsp;: &lt;SPAN&gt;GetRoomAtPoint&lt;/SPAN&gt;(&amp;nbsp;pt&amp;nbsp;,phase) .&lt;/P&gt;
&lt;P&gt;The version you are using tries to find a room in the final phase of the project, see &lt;A href="http://www.revitapidocs.com/2015/656d34c2-1e53-7278-ab83-fefaff7f40a4.htm" target="_blank"&gt;http://www.revitapidocs.com/2015/656d34c2-1e53-7278-ab83-fefaff7f40a4.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 10:52:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7405998#M55903</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-09-25T10:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Interior elevation rename</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7407888#M55904</link>
      <description>&lt;P&gt;Is the point definitely in the room? i.e. is bottom of cropbox no more than 1’ (offset you have) below room and elevation line intersecting room? Generally, I plot these points with model lines to check they are appearing in the expected location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the final version you have to also be careful of naming views with names that already exist since that will cause an exception. Routine may attempt to rename two elevations in the same room with the same name. Need to first&amp;nbsp;count how many are in each room and suffix with that number. Should also allow for fact that section may have&amp;nbsp;been moved elsewhere with same name.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 22:27:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7407888#M55904</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2017-09-25T22:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Interior elevation rename</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7407958#M55905</link>
      <description>&lt;HR /&gt;&lt;P&gt;FAIR59 wrote:&lt;/P&gt;&lt;P&gt;Maybe you have to use another overload to find the room&amp;nbsp;: &lt;SPAN&gt;GetRoomAtPoint&lt;/SPAN&gt;(&amp;nbsp;pt&amp;nbsp;,phase) .&lt;/P&gt;&lt;P&gt;The version you are using tries to find a room in the final phase of the project, see &lt;A href="http://www.revitapidocs.com/2015/656d34c2-1e53-7278-ab83-fefaff7f40a4.htm" target="_blank"&gt;http://www.revitapidocs.com/2015/656d34c2-1e53-7278-ab83-fefaff7f40a4.htm&lt;/A&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Although it was not the problem,I should have realized that phasing was going to be a factor in this. Is there a way to extract phase from the elevations? The only thing i was seeing was Phase Created and demolished ID's which was turning up as null in Revit Lookup. I know that i can lookup Phase for the view as a parameter, but how can that be converted to a phase?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 23:15:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7407958#M55905</guid>
      <dc:creator>will.wydock</dc:creator>
      <dc:date>2017-09-25T23:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Interior elevation rename</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7407973#M55906</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1035859"&gt;@RPTHOMAS108&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Is the point definitely in the room? i.e. is bottom of cropbox no more than 1’ (offset you have) below room and elevation line intersecting room? Generally, I plot these points with model lines to check they are appearing in the expected location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the final version you have to also be careful of naming views with names that already exist since that will cause an exception. Routine may attempt to rename two elevations in the same room with the same name. Need to first&amp;nbsp;count how many are in each room and suffix with that number. Should also allow for fact that section may have&amp;nbsp;been moved elsewhere with same name.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The point is definitely in the room. The problem I was having does have to do with duplicate naming. That was why I appended the count to the view name. It didn't quite perform how i thought it would, it was appending the totals for the routiine and not incrementing the view names.&amp;nbsp;Can you point me in the direction of incrementing redundant naming?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 23:25:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7407973#M55906</guid>
      <dc:creator>will.wydock</dc:creator>
      <dc:date>2017-09-25T23:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Interior elevation rename</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7408913#M55907</link>
      <description>&lt;P&gt;A phase is an Element , the&amp;nbsp; storage type of the BuiltInParameter VIEW_PHASE of the view is ElementId&lt;/P&gt;
&lt;P&gt;Phase viewphase = doc.GetElement(phaseParameter.AsElementId()) as Phase;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regarding duplicate viewnames:&lt;/P&gt;
&lt;P&gt;I would collect all the viewnames in the project, and check the new name against them, changing the new name if necessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;			List&amp;lt;string&amp;gt; viewnames = new FilteredElementCollector(doc)
				.OfClass(typeof(View))
				.Cast&amp;lt;View&amp;gt;()
				.Select(v =&amp;gt; v.Name)
				.ToList();
			int x =0;
			string newvname = "EI-"+rm.Number+x.ToString();
			while (viewnames.Contains(newvname))
			{
				x++;
				newvname = "EI-"+rm.Number+x.ToString();
			}
			viewnames.Add(newvname);
&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Sep 2017 09:21:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/interior-elevation-rename/m-p/7408913#M55907</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2017-09-26T09:21:01Z</dc:date>
    </item>
  </channel>
</rss>

