<?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 elevation using this script in InfraWorks Forum</title>
    <link>https://forums.autodesk.com/t5/infraworks-forum/change-viewport-elevation-using-this-script/m-p/6285226#M20598</link>
    <description>&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/233953i08AF11F8D7D421AA/image-size/original?v=lz-1&amp;amp;px=-1" border="0" alt="move_to_elevation.jpg" title="move_to_elevation.jpg" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use this script to change your viewport elevation. The elevation uses the units of measurement specified in your model, so if you are using meters to report elevation, then your changes to viewport elevation will adjust in meters as well:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Copy and paste this code into a code editor application such as Notepad++, and save this to extensible markup language&amp;nbsp;as "movetoelevation.ui" within the&amp;nbsp;C:\Program Files\Autodesk\InfraWorks 360 folder. Note: You can also directly download this file. The download link is included within this BIMagination blog post: &lt;A href="http://autodesk.typepad.com/bimagination/2016/04/change-viewport-elevation-using-this-script.html" target="_self"&gt;http://autodesk.typepad.com/bimagination/2016/04/change-viewport-elevation-using-this-script.html&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;ui version="4.0"&amp;gt;
 &amp;lt;class&amp;gt;Dialog&amp;lt;/class&amp;gt;
 &amp;lt;widget class="QDialog" name="Dialog"&amp;gt;
  &amp;lt;property name="geometry"&amp;gt;
   &amp;lt;rect&amp;gt;
    &amp;lt;x&amp;gt;0&amp;lt;/x&amp;gt;
    &amp;lt;y&amp;gt;0&amp;lt;/y&amp;gt;
    &amp;lt;width&amp;gt;230&amp;lt;/width&amp;gt;
    &amp;lt;height&amp;gt;103&amp;lt;/height&amp;gt;
   &amp;lt;/rect&amp;gt;
  &amp;lt;/property&amp;gt;
  &amp;lt;property name="windowTitle"&amp;gt;
   &amp;lt;string&amp;gt;Move To Elevation&amp;lt;/string&amp;gt;
  &amp;lt;/property&amp;gt;
  &amp;lt;widget class="QDialogButtonBox" name="buttonBox"&amp;gt;
   &amp;lt;property name="geometry"&amp;gt;
    &amp;lt;rect&amp;gt;
     &amp;lt;x&amp;gt;130&amp;lt;/x&amp;gt;
     &amp;lt;y&amp;gt;60&amp;lt;/y&amp;gt;
     &amp;lt;width&amp;gt;75&amp;lt;/width&amp;gt;
     &amp;lt;height&amp;gt;25&amp;lt;/height&amp;gt;
    &amp;lt;/rect&amp;gt;
   &amp;lt;/property&amp;gt;
   &amp;lt;property name="orientation"&amp;gt;
    &amp;lt;enum&amp;gt;Qt::Horizontal&amp;lt;/enum&amp;gt;
   &amp;lt;/property&amp;gt;
   &amp;lt;property name="standardButtons"&amp;gt;
    &amp;lt;set&amp;gt;QDialogButtonBox::Cancel&amp;lt;/set&amp;gt;
   &amp;lt;/property&amp;gt;
  &amp;lt;/widget&amp;gt;
  &amp;lt;widget class="QPushButton" name="moveElevation"&amp;gt;
   &amp;lt;property name="geometry"&amp;gt;
    &amp;lt;rect&amp;gt;
     &amp;lt;x&amp;gt;20&amp;lt;/x&amp;gt;
     &amp;lt;y&amp;gt;60&amp;lt;/y&amp;gt;
     &amp;lt;width&amp;gt;100&amp;lt;/width&amp;gt;
     &amp;lt;height&amp;gt;25&amp;lt;/height&amp;gt;
    &amp;lt;/rect&amp;gt;
   &amp;lt;/property&amp;gt;
   &amp;lt;property name="text"&amp;gt;
    &amp;lt;string&amp;gt;Move to Elevation&amp;lt;/string&amp;gt;
   &amp;lt;/property&amp;gt;
  &amp;lt;/widget&amp;gt;
  &amp;lt;widget class="QLineEdit" name="txtElevation"&amp;gt;
   &amp;lt;property name="geometry"&amp;gt;
    &amp;lt;rect&amp;gt;
     &amp;lt;x&amp;gt;20&amp;lt;/x&amp;gt;
     &amp;lt;y&amp;gt;30&amp;lt;/y&amp;gt;
     &amp;lt;width&amp;gt;191&amp;lt;/width&amp;gt;
     &amp;lt;height&amp;gt;20&amp;lt;/height&amp;gt;
    &amp;lt;/rect&amp;gt;
   &amp;lt;/property&amp;gt;
   &amp;lt;property name="text"&amp;gt;
    &amp;lt;string&amp;gt;2&amp;lt;/string&amp;gt;
   &amp;lt;/property&amp;gt;
  &amp;lt;/widget&amp;gt;
  &amp;lt;widget class="QLabel" name="label"&amp;gt;
   &amp;lt;property name="geometry"&amp;gt;
    &amp;lt;rect&amp;gt;
     &amp;lt;x&amp;gt;20&amp;lt;/x&amp;gt;
     &amp;lt;y&amp;gt;10&amp;lt;/y&amp;gt;
     &amp;lt;width&amp;gt;131&amp;lt;/width&amp;gt;
     &amp;lt;height&amp;gt;16&amp;lt;/height&amp;gt;
    &amp;lt;/rect&amp;gt;
   &amp;lt;/property&amp;gt;
   &amp;lt;property name="text"&amp;gt;
    &amp;lt;string&amp;gt;Elevation above surface&amp;lt;/string&amp;gt;
   &amp;lt;/property&amp;gt;
  &amp;lt;/widget&amp;gt;
 &amp;lt;/widget&amp;gt;
 &amp;lt;resources/&amp;gt;
 &amp;lt;connections&amp;gt;
  &amp;lt;connection&amp;gt;
   &amp;lt;sender&amp;gt;buttonBox&amp;lt;/sender&amp;gt;
   &amp;lt;signal&amp;gt;accepted()&amp;lt;/signal&amp;gt;
   &amp;lt;receiver&amp;gt;Dialog&amp;lt;/receiver&amp;gt;
   &amp;lt;slot&amp;gt;accept()&amp;lt;/slot&amp;gt;
   &amp;lt;hints&amp;gt;
    &amp;lt;hint type="sourcelabel"&amp;gt;
     &amp;lt;x&amp;gt;248&amp;lt;/x&amp;gt;
     &amp;lt;y&amp;gt;254&amp;lt;/y&amp;gt;
    &amp;lt;/hint&amp;gt;
    &amp;lt;hint type="destinationlabel"&amp;gt;
     &amp;lt;x&amp;gt;157&amp;lt;/x&amp;gt;
     &amp;lt;y&amp;gt;274&amp;lt;/y&amp;gt;
    &amp;lt;/hint&amp;gt;
   &amp;lt;/hints&amp;gt;
  &amp;lt;/connection&amp;gt;
  &amp;lt;connection&amp;gt;
   &amp;lt;sender&amp;gt;buttonBox&amp;lt;/sender&amp;gt;
   &amp;lt;signal&amp;gt;rejected()&amp;lt;/signal&amp;gt;
   &amp;lt;receiver&amp;gt;Dialog&amp;lt;/receiver&amp;gt;
   &amp;lt;slot&amp;gt;reject()&amp;lt;/slot&amp;gt;
   &amp;lt;hints&amp;gt;
    &amp;lt;hint type="sourcelabel"&amp;gt;
     &amp;lt;x&amp;gt;316&amp;lt;/x&amp;gt;
     &amp;lt;y&amp;gt;260&amp;lt;/y&amp;gt;
    &amp;lt;/hint&amp;gt;
    &amp;lt;hint type="destinationlabel"&amp;gt;
     &amp;lt;x&amp;gt;286&amp;lt;/x&amp;gt;
     &amp;lt;y&amp;gt;274&amp;lt;/y&amp;gt;
    &amp;lt;/hint&amp;gt;
   &amp;lt;/hints&amp;gt;
  &amp;lt;/connection&amp;gt;
 &amp;lt;/connections&amp;gt;
&amp;lt;/ui&amp;gt;
&lt;/PRE&gt;
&lt;P&gt;2) Open InfraWorks 360 and navigate to the position in your model where you want to adjust the viewport elevation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Open the &lt;A href="http://help.autodesk.com/view/INFMDR/ENU/?guid=GUID-6CCCDB7F-E136-42A1-ACE2-F119EAF75B6B" target="_self"&gt;Scripting Console&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;4) Copy and paste this script into the Scripting Area:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// Global variables
var db = app.ActiveModelDb; // handle for open model database
var model = app.ActiveModel; // active model
var doc = app.ActiveDocument(); // active document
var dbWkt = app.ActiveModel.CoordSysWkt;
var wkt = app.GetBestFittingUTM84ProjectionWkt(model.Boundary.BBox2d, dbWkt);

// Load the UI
var form = ui.LoadForm("movetoelevation.ui");
form.findChild("moveElevation").clicked.connect(MoveToElevation);

function MoveToElevation() {
	// height to adjust from surface 
	var hgt = (parseFloat (form.findChild("txtElevation").text));

	var posDom = model.GetViewPoint()["pos"];
	var pos = new adsk.Vec3d(posDom[0], posDom[1], posDom[2]); // create Vec3d from DOM
	//print("posWorld: " + pos.X + "," + pos.Y + "," + pos.Z);

	// Transform from world into DB
	var posDB = model.Transforms.transformWorld2DB(pos);
	print("Position: " + posDB.X + "," + posDB.Y + "," + posDB.Z);

	var ePnt = doc.FindElevation(new adsk.Vec3d(posDB.X, posDB.Y, 0));
	print("Existing surface elevation: " + ePnt.Z);

	// Elevate camera above surface level
	ePnt.Z += hgt;
	print("New surface elevation: " + ePnt.Z);
	print("------------------------------------------");

	// transform DB back to world
	pos = model.Transforms.transformDB2World(ePnt);
	var resDom = {
		pos : [pos.X, pos.Y, pos.Z]
	};
	model.SetViewPoint(resDom);
}

form.show();
gc();&lt;/PRE&gt;
&lt;P&gt;5) Click Start Script. A dialog will appear in your model.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/233964iB8AC89D6BB4FB02B/image-size/original?v=lz-1&amp;amp;px=-1" border="0" alt="elevation_ui.jpg" title="elevation_ui.jpg" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;6) Add an elevation offset value and click Move to Elevation.&lt;/P&gt;
&lt;P&gt;The script adjusts your viewport elevation based on the ground surface elevation for your location. Therefore, if your ground surface elevation (*reported&amp;nbsp;by&amp;nbsp;the Z: value in the Status Bar) is already 180 meters, and you want your viewport to instead be at 250 meters elevation, then you would enter 70 into the Move to Elevation dialog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;7) The Scripting Console will report the elevation change, so you can double-check your original and updated viewport elevation.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/233973i64F9841A5C73D737/image-size/original?v=lz-1&amp;amp;px=-1" border="0" alt="script_evaluation.jpg" title="script_evaluation.jpg" /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Apr 2016 16:36:28 GMT</pubDate>
    <dc:creator>elliott.rosenfeld</dc:creator>
    <dc:date>2016-04-26T16:36:28Z</dc:date>
    <item>
      <title>Change viewport elevation using this script</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/change-viewport-elevation-using-this-script/m-p/6285226#M20598</link>
      <description>&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/233953i08AF11F8D7D421AA/image-size/original?v=lz-1&amp;amp;px=-1" border="0" alt="move_to_elevation.jpg" title="move_to_elevation.jpg" /&gt;&lt;/P&gt;
&lt;P&gt;This script will allow you to change&amp;nbsp;your viewport elevation by any numeric value you specify.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 16:36:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/change-viewport-elevation-using-this-script/m-p/6285226#M20598</guid>
      <dc:creator>elliott.rosenfeld</dc:creator>
      <dc:date>2016-04-26T16:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Change viewport elevation using this script</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/change-viewport-elevation-using-this-script/m-p/6297718#M20599</link>
      <description>&lt;P&gt;This is a high-quality information!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 11:45:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/change-viewport-elevation-using-this-script/m-p/6297718#M20599</guid>
      <dc:creator>Eduardo.Soethe</dc:creator>
      <dc:date>2016-04-28T11:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Change viewport elevation using this script</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/change-viewport-elevation-using-this-script/m-p/6298420#M20600</link>
      <description>&lt;P&gt;Just curious how you got the cross walk striping in? &amp;nbsp;Thanks for your excellent posts!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 15:34:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/change-viewport-elevation-using-this-script/m-p/6298420#M20600</guid>
      <dc:creator>sduffin</dc:creator>
      <dc:date>2016-04-28T15:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Change viewport elevation using this script</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/change-viewport-elevation-using-this-script/m-p/6298483#M20601</link>
      <description>&lt;P&gt;The crosswalk striping in that photo is actually a default decoration called "zebra cossing" that you can add to road styles. You can find it here:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/235712iA027F7E60950CF2C/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="zebra_crossing.png" title="zebra_crossing.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2016 16:03:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/change-viewport-elevation-using-this-script/m-p/6298483#M20601</guid>
      <dc:creator>elliott.rosenfeld</dc:creator>
      <dc:date>2016-04-28T16:03:02Z</dc:date>
    </item>
  </channel>
</rss>

