<?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 Rename a scope box via api in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5366803#M75168</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to rename a scope box via the api?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get the name of a scope box with element.name it does not seem to be parameter diven.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However if I try to set the name of the element I get. This element does not support assignment of a user-specified name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Oct 2014 04:35:15 GMT</pubDate>
    <dc:creator>david_rock</dc:creator>
    <dc:date>2014-10-29T04:35:15Z</dc:date>
    <item>
      <title>Rename a scope box via api</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5366803#M75168</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to rename a scope box via the api?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get the name of a scope box with element.name it does not seem to be parameter diven.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However if I try to set the name of the element I get. This element does not support assignment of a user-specified name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Oct 2014 04:35:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5366803#M75168</guid>
      <dc:creator>david_rock</dc:creator>
      <dc:date>2014-10-29T04:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Rename a scope box via api</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5369585#M75169</link>
      <description>&lt;P&gt;Maybe the scope box name is used as some kind of identifier to link it with some other object?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2014 08:01:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5369585#M75169</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2014-10-30T08:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Rename a scope box via api</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5487109#M75170</link>
      <description>&lt;P&gt;Anouther issue I'm having is I can't seem to collect the scope boxes from a linked model. The following works if the&amp;nbsp;&lt;SPAN&gt;objDocument is the active document but not if the document is linked.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Shared Function GetAllScopeBoxs(ByVal objDocument As Autodesk.Revit.DB.Document) As List(Of Element)&lt;BR /&gt;Try&lt;BR /&gt;Dim ListOfElement As New List(Of Element)&lt;BR /&gt;Dim ElementIter As IEnumerator&lt;BR /&gt;Dim objCollector As New FilteredElementCollector(objDocument)&lt;BR /&gt;Dim eleactiveDBdoc As FilteredElementCollector = objCollector.WhereElementIsNotElementType()&lt;BR /&gt;ElementIter = eleactiveDBdoc.GetEnumerator&lt;BR /&gt;Do While ElementIter.MoveNext&lt;BR /&gt;Dim objElement As Element = ElementIter.Current&lt;BR /&gt;Dim objCategory As Category = objElement.Category&lt;BR /&gt;If objCategory IsNot Nothing Then&lt;BR /&gt;If objCategory.Name.Contains("Scope Boxes") Then&lt;BR /&gt;ListOfElement.Add(objElement)&lt;BR /&gt;End If&lt;BR /&gt;End If&lt;BR /&gt;Loop&lt;BR /&gt;Return ListOfElement&lt;BR /&gt;Catch ex As Exception&lt;BR /&gt;msgbox(ex.message)&lt;BR /&gt;Return Nothing&lt;BR /&gt;End Try&lt;BR /&gt;End Function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2015 00:31:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5487109#M75170</guid>
      <dc:creator>david_rock</dc:creator>
      <dc:date>2015-01-29T00:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Rename a scope box via api</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5487144#M75171</link>
      <description>&lt;P&gt;Try using a category&amp;nbsp;filter on your FilteredElementCollector instead of checking to see if the category name contains "Scope Boxes". If your linked Revit models are in another language, your check for the name of the category would fail. &amp;nbsp;&lt;/P&gt;&lt;PRE&gt;.OfCategory(BuiltInCategory.OST_VolumeOfInterest)&lt;/PRE&gt;&lt;P&gt;It's not immediately obvious, but OST_VolumeOfInterest is the category that scope boxes belong to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This&amp;nbsp;should also increase the performance of your code by a fair bit, since you are now only retrieving scope boxes instead of checking every instance element in the project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote a quick test macro and was able to retrieve the scope boxes from a linked model (Revit 2015).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public void ScopeBoxTest()
		{
			Document doc = this.ActiveUIDocument.Document;
			
			//Helper function
			var loadedLinkDocs = doc.GetLoadedLinkedDocuments();
			
			var firstDoc = loadedLinkDocs.First();
			
			var linkedScopeBoxes = new FilteredElementCollector(firstDoc).OfCategory(BuiltInCategory.OST_VolumeOfInterest).ToList();
			
			TaskDialog.Show("Result", string.Format("{0} scope boxes found in linked model", linkedScopeBoxes.Count));
		}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2015 01:17:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5487144#M75171</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-29T01:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Rename a scope box via api</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5708760#M75172</link>
      <description>&lt;P&gt;Here's how I managed to batch change the scope boxes names&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;		public void ChangeNameScopeBox()
		{
			
			UIDocument uidoc = this.ActiveUIDocument;
			Document doc = uidoc.Document;
			
			string checkstring="";
			string originalName="";
			string newName="";
			
			View3D view = doc.ActiveView as View3D;
			
			 if( null == view )
			  {
			 	TaskDialog.Show("error", "Please run this command in a 3D view.");
			    return;
			  }
			 
			 
			
			// get all elements in the model
			ICollection&amp;lt;Element&amp;gt; scopeBoxes = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_VolumeOfInterest).ToElements();

			
			// create and start a new transaction
			using(Transaction t = new Transaction(doc, "Change scopebox name"))
			{
				t.Start();
				
				foreach (Element e in scopeBoxes) {
					
					if (e.Name.Contains("De coupage")) {
						
						originalName = e.Name;
						newName = originalName.Replace("De coupage","Decoupage");
						
						Parameter par = e.get_Parameter(BuiltInParameter.VOLUME_OF_INTEREST_NAME);
						par.Set(newName);
						
					    checkstring=checkstring + Environment.NewLine + e.Name;
					}
				}
				
				
				// finalize transaction				
				t.Commit();

				// show dialog of how many views were created
				TaskDialog.Show("Cahnged scopeboxes", "scopeboxes: " +checkstring);	
			}
				
		}&lt;/PRE&gt;
&lt;P&gt;You can acces the bulit parameter wich stores the Name&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Parameter par = e.get_Parameter(BuiltInParameter.VOLUME_OF_INTEREST_NAME);&lt;/PRE&gt;
&lt;P&gt;I've got the "inspiration from Jeremy's bolg:&amp;nbsp;&lt;A href="http://thebuildingcoder.typepad.com/blog/2012/08/set-view-section-box-to-match-scope-box.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2012/08/set-view-section-box-to-match-scope-box.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2015 13:53:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5708760#M75172</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-07T13:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: Rename a scope box via api</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5710257#M75173</link>
      <description>BuiltInParameter.VOLUME_OF_INTEREST_NAME&lt;BR /&gt;&lt;BR /&gt;Ahh so easy, thank you so much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 08 Jul 2015 10:22:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/rename-a-scope-box-via-api/m-p/5710257#M75173</guid>
      <dc:creator>david_rock</dc:creator>
      <dc:date>2015-07-08T10:22:25Z</dc:date>
    </item>
  </channel>
</rss>

