<?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 Change Viewport type in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7797947#M52210</link>
    <description>I am working on a routine that would be used to change types on Viewports. How can I change family types for the VP based on the name string value rather than the Id?</description>
    <pubDate>Thu, 22 Feb 2018 04:30:49 GMT</pubDate>
    <dc:creator>will.wydock</dc:creator>
    <dc:date>2018-02-22T04:30:49Z</dc:date>
    <item>
      <title>Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7797947#M52210</link>
      <description>I am working on a routine that would be used to change types on Viewports. How can I change family types for the VP based on the name string value rather than the Id?</description>
      <pubDate>Thu, 22 Feb 2018 04:30:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7797947#M52210</guid>
      <dc:creator>will.wydock</dc:creator>
      <dc:date>2018-02-22T04:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7798422#M52211</link>
      <description>&lt;P&gt;Dear Wwydock,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your query.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, it leaves me still wondering what is is you wish to achieve.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you clarify, please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 09:08:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7798422#M52211</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-02-22T09:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7800596#M52212</link>
      <description>&lt;P&gt;What i am trying to achieve is my company's standard is to place a graphic scale at the far end of the view title so what have done is created a viewtitle (at various lengths for word wrapping. What i want to do is when i run my routine i will select a viewport and it will read the current viewport type(6" Title ) and replace it will with the&amp;nbsp;type that has graphic scale appended to&amp;nbsp; it(&lt;SPAN&gt;6" Title w/Scale) and then it would fill in the graphic scale values based on what it pulls from the "Scalevalue 1:"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am still working on applying the values to the viewtitle graphic scale but here is what i have&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="2"&gt;		public void GraphicScale()
		{
			
			UIDocument uidoc=this.ActiveUIDocument;
			Document doc= uidoc.Document;
			
			ISelectionFilter viewportfilter = new ViewPortPickFilter();
            Reference refa = uidoc.Selection.PickObject(ObjectType.Element, viewportfilter, "Select a viewport.");
            Element e = doc.GetElement(refa);
            //get view associated with viewport, 
            FilteredElementCollector viewCollector = new FilteredElementCollector(doc).OfClass(typeof(View)).
			
            using (Transaction trans = new Transaction(doc, "Rename Sheets"))
            {
                trans.Start();
                {

                    Parameter paramscalefactor = e.LookupParameter("Scale Value    1:");
                    double vscalefactor = Convert.ToDouble(paramscalefactor.AsValueString());
					
                    e.LookupParameter("SCALE1").Set(vscalefactor/24);
                    e.LookupParameter("SCALE2").Set(vscalefactor/12);
                    e.LookupParameter("SCALE3").Set(vscalefactor/8);
                    e.LookupParameter("SCALE4").Set(vscalefactor/6);
                    //TaskDialog.Show("Test","Graphic Scale is "+vscalefactor);

                }
                trans.Commit();
            }
        }
    
	}
	 public class ViewPortPickFilter : ISelectionFilter
    {
        public bool AllowElement(Element e)
        {
            return (e.Category.Id.IntegerValue.Equals(
             (int)BuiltInCategory.OST_Viewports));
        }

        public bool AllowReference(Reference r, XYZ p)
        {
            return false;
        }
    }&lt;/FONT&gt;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 18:00:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7800596#M52212</guid>
      <dc:creator>will.wydock</dc:creator>
      <dc:date>2018-02-22T18:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7805906#M52213</link>
      <description>&lt;P&gt;Not sure why you would want to do this? From your description it sounds like this can be done via editing the family of the annotation symbol used for the viewport title:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="24-02-1700.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/467257i3D91BE2FFFDF11B3/image-size/large?v=v2&amp;amp;px=999" role="button" title="24-02-1700.png" alt="24-02-1700.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as your code goes I recommend using BIP values rather than looking up by parameter name&lt;/P&gt;&lt;P&gt;VIEW_SCALE_PULLDOWN_METRIC -1005151&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;VIEW_SCALE_PULLDOWN_IMPERIAL -1005152&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both return an integer so no&amp;nbsp;need to incur the overhead of the .AsValueString method coupled with converting string to a double, just use .AsInteger&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2018 17:14:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7805906#M52213</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2018-02-24T17:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7806392#M52214</link>
      <description>&lt;P&gt;This is the graphic scale that i am referring to, I have already created the necessary family types with the lengths.&amp;nbsp; Our standard is to have the default viewport type not include the graphic scale. So I woulds like users to run a routine that would automatically switch over the type to one that includes graphic scale and fill in the values for the scale.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Capture.PNG" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/467356iD9E68BB80DF4E123/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2018 00:40:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7806392#M52214</guid>
      <dc:creator>will.wydock</dc:creator>
      <dc:date>2018-02-25T00:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7807175#M52215</link>
      <description>&lt;P&gt;I understand what you mean now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your scale parameters need to be shared parameters within the annotation symbol family that is used for the viewport title. Then you bind the same shared parameters to the views category in the project. You’ll then be able to set the parameter values on the associated view and they’ll get passed through to the viewport title block family and appear on the sheet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe that is the only way.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2018 18:09:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7807175#M52215</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2018-02-25T18:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7808713#M52216</link>
      <description>&lt;P&gt;to find and replace the viewporttype use&amp;nbsp; this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;			const char char_quote = (char) 34;
			string viewport_with_scale_Name = string.Format("6{0} Title w/Scale",char_quote); //6" Title w/Scale
			&amp;nbsp;		
			ElementType scaledViewPortType = null;
			ElementType currentViewprtType = doc.GetElement(viewport.GetTypeId()) as ElementType;
&amp;nbsp;			if (currentViewprtType.Name != viewport_with_scale_Name)
&amp;nbsp;			{
&amp;nbsp;				foreach (ElementId id in viewport.GetValidTypes())
&amp;nbsp;				{
&amp;nbsp;					ElementType typ = doc.GetElement(id) as ElementType;
&amp;nbsp;					if (typ.Name == viewport_with_scale_Name)
&amp;nbsp;					{
&amp;nbsp;						scaledViewPortType = typ;
&amp;nbsp;						break;
&amp;nbsp;					}
&amp;nbsp;				}
&amp;nbsp;			}
&amp;nbsp;			if (scaledViewPortType!= null)
&amp;nbsp;			{
&amp;nbsp;				using (Transaction t = new Transaction(doc,"change_viewporttype"))
&amp;nbsp;				{
&amp;nbsp;					t.Start();
&amp;nbsp;					viewport.ChangeTypeId(scaledViewPortType.Id);
&amp;nbsp;					doc.Regenerate();
&amp;nbsp;					t.Commit();
&amp;nbsp;				}
&amp;nbsp;			}
&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Feb 2018 12:12:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7808713#M52216</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2018-02-26T12:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7811039#M52217</link>
      <description>&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was looking at what you had posted and would like to utilize it, but I am having trouble with either setting up different if statements or concatenating on to the existing viewport name. When I am trying to test it in a dialog box I am getting an error that it is an empty value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is what i was using&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;string vpname="";			
vpname=currentViewprtType.Name;
TaskDialog.Show("",vpname);&lt;/PRE&gt;&lt;P&gt;is there something i am missing or another way to accomplish this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 00:57:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7811039#M52217</guid>
      <dc:creator>will.wydock</dc:creator>
      <dc:date>2018-02-27T00:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7811497#M52218</link>
      <description>&lt;P&gt;Dear Wwydock,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your update and sorry to hear you are still struggling with this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried running your code in the debugger and stepping through it line by line?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should make any such problem pretty apparent and easy to identify.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 07:32:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7811497#M52218</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-02-27T07:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7813981#M52219</link>
      <description>&lt;P&gt;TaskDialog.Show(&lt;FONT color="#ff0000"&gt;""&lt;/FONT&gt;,vpname);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TaskDialog can't have empty title.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 22:01:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7813981#M52219</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2018-02-27T22:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7859705#M52220</link>
      <description>&lt;P&gt;Thanks, that was a dumb mistake on my part.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As part of my routine i changed the viewport types and applied parameter values based on scale. Everything changes except the changes in the parameter values. Is there a way to graphically refresh the element? I have already tried doc.regenerate and uidoc.refreshactiveview.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 13:40:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7859705#M52220</guid>
      <dc:creator>will.wydock</dc:creator>
      <dc:date>2018-03-16T13:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7860213#M52221</link>
      <description>&lt;P&gt;Dear Wwydock,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do these suggestions help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2014/06/refresh-element-graphics-display.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2014/06/refresh-element-graphics-display.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2017/11/cloud-model-predicate-and-set-parameter-regenerates.html#3" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2017/11/cloud-model-predicate-and-set-parameter-regenerates.html#3&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 16:09:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7860213#M52221</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-03-16T16:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7861169#M52222</link>
      <description>&lt;P&gt;Have you created shared parameters and linked them through in the manor as noted above?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 23:19:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7861169#M52222</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2018-03-16T23:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7866258#M52223</link>
      <description>&lt;P&gt;I was able to get it to work by creating a second transaction and using&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  ElementTransformUtils.MoveElement(doc, viewport.Id, XYZ.BasisX);
  ElementTransformUtils.MoveElement(doc, viewport.Id, XYZ.BasisX.Negate());&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Mar 2018 20:33:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7866258#M52223</guid>
      <dc:creator>will.wydock</dc:creator>
      <dc:date>2018-03-19T20:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Change Viewport type</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7867262#M52224</link>
      <description>&lt;P&gt;Dear Wwydock,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Congratulations on fixing it, and thank you for letting us know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am glad that the move-back-and-forth trick helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try it with a zero vector as well?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try any of the other methods?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 08:00:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-viewport-type/m-p/7867262#M52224</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-03-20T08:00:14Z</dc:date>
    </item>
  </channel>
</rss>

