<?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 Re: I want to create a new Layout programatically in ArcGIS Pro SDK. How to do that?   in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/i-want-to-create-a-new-layout-programatically-in/m-p/808446#M2276</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Suryakant,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm really glad you found a work-around for what you need at 2.0 but I'm curious if it really solves the issue.&amp;nbsp;&amp;nbsp;It looks like you&amp;nbsp;found a way to execute the existing New Layout command but how are you adding new elements to it?&amp;nbsp; At 2.1, not only will you be able to create layouts, open them in panes, but you will be able to create all layout element types.&amp;nbsp; Have you found a way to do that too?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Nov 2017 17:22:38 GMT</pubDate>
    <dc:creator>JeffBarrette</dc:creator>
    <dc:date>2017-11-30T17:22:38Z</dc:date>
    <item>
      <title>I want to create a new Layout programatically in ArcGIS Pro SDK. How to do that?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/i-want-to-create-a-new-layout-programatically-in/m-p/808443#M2273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to programatically create a new Layout, Open Layout Pane and Switch to Layout View in ArcGIS Pro SDK?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2017 06:52:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/i-want-to-create-a-new-layout-programatically-in/m-p/808443#M2273</guid>
      <dc:creator>SuryakantUpadhayay</dc:creator>
      <dc:date>2017-10-30T06:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: I want to create a new Layout programatically in ArcGIS Pro SDK. How to do that?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/i-want-to-create-a-new-layout-programatically-in/m-p/808444#M2274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The creation of layouts and layout elements is coming at 2.1.&amp;nbsp; Currently you can only reference existing layouts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a snippet to create a new, simple layout:&lt;/P&gt;&lt;PRE style="padding: 16px; border-radius: 3px; color: #24292e; text-transform: none; line-height: 1.45; text-indent: 0px; letter-spacing: normal; overflow: auto; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; font-style: normal; font-weight: normal; margin-top: 0px; margin-bottom: 0px; word-spacing: 0px; -ms-word-break: normal; -ms-word-wrap: normal; box-sizing: border-box; orphans: 2; widows: 2; background-color: #f6f8fa; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;SPAN style="color: #6a737d; box-sizing: border-box;"&gt;//Create a new layout project item layout in the project&lt;/SPAN&gt;&lt;SPAN style="color: #6f42c1; box-sizing: border-box;"&gt;Layout&lt;/SPAN&gt; &lt;SPAN style="color: #6f42c1; box-sizing: border-box;"&gt;newLayout&lt;/SPAN&gt; = &lt;SPAN style="color: #d73a49; box-sizing: border-box;"&gt;await&lt;/SPAN&gt; &lt;SPAN style="color: #6f42c1; box-sizing: border-box;"&gt;QueuedTask.Run&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: #6f42c1; box-sizing: border-box;"&gt;Layout&lt;/SPAN&gt;&amp;gt;(() =&amp;gt; {&amp;nbsp;&amp;nbsp; newLayout = LayoutFactory.Instance.CreateLayout(&lt;SPAN style="color: #005cc5; box-sizing: border-box;"&gt;8.5&lt;/SPAN&gt;, &lt;SPAN style="color: #005cc5; box-sizing: border-box;"&gt;11&lt;/SPAN&gt;, LinearUnit.Inches);&amp;nbsp;&amp;nbsp; newLayout.SetName(&lt;SPAN style="color: #032f62; box-sizing: border-box;"&gt;"New 8.5x11 Layout"&lt;/SPAN&gt;);&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #d73a49; box-sizing: border-box;"&gt;return&lt;/SPAN&gt; newLayout; });&lt;SPAN style="color: #6a737d; box-sizing: border-box;"&gt;//Open new layout on the GUI thread&lt;/SPAN&gt;&lt;SPAN style="color: #6f42c1; box-sizing: border-box;"&gt;ProApp.Panes.CreateLayoutPane&lt;/SPAN&gt;(newLayout);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another example on managing layout views&lt;/P&gt;&lt;PRE style="padding: 16px; border-radius: 3px; color: #24292e; text-transform: none; line-height: 1.45; text-indent: 0px; letter-spacing: normal; overflow: auto; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; font-style: normal; font-weight: normal; margin-top: 0px; margin-bottom: 0px; word-spacing: 0px; -ms-word-break: normal; -ms-word-wrap: normal; box-sizing: border-box; orphans: 2; widows: 2; background-color: #f6f8fa; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;SPAN style="color: #6a737d; box-sizing: border-box;"&gt;//A layout view may exist but it may not be active&lt;/SPAN&gt;&lt;SPAN style="color: #6a737d; box-sizing: border-box;"&gt;//Iterate through each pane in the application and check to see if the layout is already open and if so, activate it&lt;/SPAN&gt;&lt;SPAN style="color: #d73a49; box-sizing: border-box;"&gt;foreach&lt;/SPAN&gt; (&lt;SPAN style="color: #6f42c1; box-sizing: border-box;"&gt;var&lt;/SPAN&gt; pane in ProApp.Panes) {&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #d73a49; box-sizing: border-box;"&gt;var&lt;/SPAN&gt; &lt;SPAN style="color: #6f42c1; box-sizing: border-box;"&gt;layoutPane &lt;/SPAN&gt;= pane &lt;SPAN style="color: #6f42c1; box-sizing: border-box;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #6f42c1; box-sizing: border-box;"&gt;ILayoutPane&lt;/SPAN&gt;;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #d73a49; box-sizing: border-box;"&gt;if&lt;/SPAN&gt; (layoutPane == &lt;SPAN style="color: #005cc5; box-sizing: border-box;"&gt;null&lt;/SPAN&gt;)&amp;nbsp; &lt;SPAN style="color: #6a737d; box-sizing: border-box;"&gt;//if not a layout view, continue to the next pane&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #d73a49; box-sizing: border-box;"&gt;continue&lt;/SPAN&gt;;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #d73a49; box-sizing: border-box;"&gt;if&lt;/SPAN&gt; (layoutPane.LayoutView.Layout == lyt) &lt;SPAN style="color: #6a737d; box-sizing: border-box;"&gt;//if there is a match, activate the view&lt;/SPAN&gt;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (layoutPane &lt;SPAN style="color: #d73a49; box-sizing: border-box;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #6f42c1; box-sizing: border-box;"&gt;Pane&lt;/SPAN&gt;).Activate();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #d73a49; box-sizing: border-box;"&gt;return&lt;/SPAN&gt;;&amp;nbsp;&amp;nbsp; } }&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There will be many more layout pro snippets addressing these new capabilities when 2.1 is released.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2017 17:43:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/i-want-to-create-a-new-layout-programatically-in/m-p/808444#M2274</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2017-10-30T17:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: I want to create a new Layout programatically in ArcGIS Pro SDK. How to do that? </title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/i-want-to-create-a-new-layout-programatically-in/m-p/808445#M2275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, I found a way to open new Layout Programatically in 2.0 SDK too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_projectContainer_NewLayout");&lt;BR /&gt;var wcommand = wrapper as ICommand;&lt;BR /&gt;if (wcommand == null)&lt;BR /&gt;return;&lt;/P&gt;&lt;P&gt;if (wcommand.CanExecute(null))&lt;BR /&gt;wcommand.Execute(null);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once the Layout is opened&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LayoutProjectItem layoutItem = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;().LastOrDefault&amp;lt;LayoutProjectItem&amp;gt;();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then we can do whatever we want to on the Layout.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Nov 2017 05:11:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/i-want-to-create-a-new-layout-programatically-in/m-p/808445#M2275</guid>
      <dc:creator>SuryakantUpadhayay</dc:creator>
      <dc:date>2017-11-30T05:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: I want to create a new Layout programatically in ArcGIS Pro SDK. How to do that?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/i-want-to-create-a-new-layout-programatically-in/m-p/808446#M2276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Suryakant,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm really glad you found a work-around for what you need at 2.0 but I'm curious if it really solves the issue.&amp;nbsp;&amp;nbsp;It looks like you&amp;nbsp;found a way to execute the existing New Layout command but how are you adding new elements to it?&amp;nbsp; At 2.1, not only will you be able to create layouts, open them in panes, but you will be able to create all layout element types.&amp;nbsp; Have you found a way to do that too?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Nov 2017 17:22:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/i-want-to-create-a-new-layout-programatically-in/m-p/808446#M2276</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2017-11-30T17:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: I want to create a new Layout programatically in ArcGIS Pro SDK. How to do that? </title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/i-want-to-create-a-new-layout-programatically-in/m-p/808447#M2277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeff,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, it solved my purpose. Though I had to do some tricks and workarounds.&lt;/P&gt;&lt;P&gt;So, I added 3 elements programatically after I created new Layout as described above. Those elements were MapFrame, North Arrow and Scale Bar. But, I believe similar thing can be done for other elements too.&lt;/P&gt;&lt;P&gt;To create a Map Frame I used following :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_newMapFrameButton");&lt;BR /&gt; wcommand = wrapper as ICommand;&lt;BR /&gt; if (wcommand == null)&lt;BR /&gt; return;&lt;/P&gt;&lt;P&gt;if (wcommand.CanExecute(null))&lt;BR /&gt; wcommand.Execute(null);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then to set its property or zoom level:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LayoutProjectItem layoutItem = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;().LastOrDefault&amp;lt;LayoutProjectItem&amp;gt;();&lt;BR /&gt; if (layoutItem != null)&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Layout layout = layoutItem.GetLayout();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (layout == null)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MapFrame mf = layout.Elements.FirstOrDefault(item =&amp;gt; item.Name.Equals("Map Frame")) as MapFrame;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while (mf == null) //actually in large projects Loading map frames takes some time so this is just waiting for it to happen&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Task.Delay(TimeSpan.FromSeconds(1));&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mf = layout.Elements.FirstOrDefault(item =&amp;gt; item.Name.Equals("Map Frame")) as MapFrame;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mf.SetCamera(camera); //camera is where ever I want to focus/zoom&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Scale Bar:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;await Task.Delay(TimeSpan.FromSeconds(6));&lt;BR /&gt; wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_newScaleBarButton");&lt;BR /&gt; wcommand = wrapper as ICommand;&lt;BR /&gt; if (wcommand == null)&lt;BR /&gt; return;&lt;/P&gt;&lt;P&gt;if (wcommand.CanExecute(null))&lt;BR /&gt; wcommand.Execute(null);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For North Arrow:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_newNorthArrowButton");&lt;BR /&gt; wcommand = wrapper as ICommand;&lt;BR /&gt; if (wcommand == null)&lt;BR /&gt; return;&lt;/P&gt;&lt;P&gt;if (wcommand.CanExecute(null))&lt;BR /&gt; wcommand.Execute(null);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the same manner as for MapFrame :&lt;/P&gt;&lt;P&gt;NorthArrow northArrow = layout.Elements.FirstOrDefault(item =&amp;gt; item.Name.Equals("North Arrow")) as NorthArrow;&lt;BR /&gt; ScaleBar scaleBar = layout.Elements.FirstOrDefault(item =&amp;gt; item.Name.Equals("Scale Bar")) as ScaleBar;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once I got these objects I played with it and set what&amp;nbsp; wanted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Roughly, my test code looks like following as a whole. Its not optimized and organized yet&amp;nbsp;as it was just for testing but yes it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Camera camera = MapView.Active.Camera;&lt;BR /&gt; int count = ArcGIS.Desktop.Framework.FrameworkApplication.Panes.Find("esri_layouts_layoutPane").Count;&lt;BR /&gt; var wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_projectContainer_NewLayout");&lt;BR /&gt; var wcommand = wrapper as ICommand;&lt;BR /&gt; if (wcommand == null)&lt;BR /&gt; return;&lt;/P&gt;&lt;P&gt;if (wcommand.CanExecute(null))&lt;BR /&gt; wcommand.Execute(null);&lt;/P&gt;&lt;P&gt;while (ArcGIS.Desktop.Framework.FrameworkApplication.Panes.Find("esri_layouts_layoutPane").Count == count)&lt;BR /&gt; {&lt;BR /&gt; await Task.Delay(TimeSpan.FromSeconds(3));&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_newMapFrameButton");&lt;BR /&gt; wcommand = wrapper as ICommand;&lt;BR /&gt; if (wcommand == null)&lt;BR /&gt; return;&lt;/P&gt;&lt;P&gt;if (wcommand.CanExecute(null))&lt;BR /&gt; wcommand.Execute(null);&lt;BR /&gt; await Task.Delay(TimeSpan.FromSeconds(1));&lt;/P&gt;&lt;P&gt;LayoutProjectItem layoutItem = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;().LastOrDefault&amp;lt;LayoutProjectItem&amp;gt;();&lt;BR /&gt; if (layoutItem != null)&lt;BR /&gt; {&lt;BR /&gt; await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =&amp;gt;&lt;BR /&gt; {&lt;BR /&gt; // Reference and load the layout associated with the layout item&lt;BR /&gt; Layout layout = layoutItem.GetLayout();&lt;BR /&gt; if (layout == null)&lt;BR /&gt; return;&lt;/P&gt;&lt;P&gt;// Reference a mapframe by name&lt;BR /&gt; MapFrame mf = layout.Elements.FirstOrDefault(item =&amp;gt; item.Name.Equals("Map Frame")) as MapFrame;&lt;BR /&gt; while (mf == null)&lt;BR /&gt; {&lt;BR /&gt; Task.Delay(TimeSpan.FromSeconds(1));&lt;BR /&gt; mf = layout.Elements.FirstOrDefault(item =&amp;gt; item.Name.Equals("Map Frame")) as MapFrame;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;mf.SetCamera(camera);&lt;/P&gt;&lt;P&gt;});&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;await Task.Delay(TimeSpan.FromSeconds(6));&lt;BR /&gt; wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_newScaleBarButton");&lt;BR /&gt; wcommand = wrapper as ICommand;&lt;BR /&gt; if (wcommand == null)&lt;BR /&gt; return;&lt;/P&gt;&lt;P&gt;if (wcommand.CanExecute(null))&lt;BR /&gt; wcommand.Execute(null);&lt;BR /&gt; layoutItem = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;().LastOrDefault&amp;lt;LayoutProjectItem&amp;gt;();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; await Task.Delay(TimeSpan.FromSeconds(6));&lt;BR /&gt; wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_newNorthArrowButton");&lt;BR /&gt; wcommand = wrapper as ICommand;&lt;BR /&gt; if (wcommand == null)&lt;BR /&gt; return;&lt;/P&gt;&lt;P&gt;if (wcommand.CanExecute(null))&lt;BR /&gt; wcommand.Execute(null);&lt;BR /&gt; await Task.Delay(TimeSpan.FromSeconds(6));&lt;BR /&gt; layoutItem = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;().LastOrDefault&amp;lt;LayoutProjectItem&amp;gt;();&lt;BR /&gt; await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =&amp;gt;&lt;BR /&gt; {&lt;BR /&gt; while (layoutItem.GetLayout().Elements.Count() != 3)&lt;BR /&gt; {&lt;BR /&gt; Task.Delay(TimeSpan.FromSeconds(1));&lt;BR /&gt; layoutItem = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;().LastOrDefault&amp;lt;LayoutProjectItem&amp;gt;();&lt;BR /&gt; }&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =&amp;gt;&lt;BR /&gt; {&lt;BR /&gt; // Reference and load the layout associated with the layout item&lt;BR /&gt; Layout layout = layoutItem.GetLayout();&lt;BR /&gt; if (layout == null)&lt;BR /&gt; return;&lt;/P&gt;&lt;P&gt;// Reference a mapframe by name&lt;BR /&gt; NorthArrow northArrow = layout.Elements.FirstOrDefault(item =&amp;gt; item.Name.Equals("North Arrow")) as NorthArrow;&lt;BR /&gt; ScaleBar scaleBar = layout.Elements.FirstOrDefault(item =&amp;gt; item.Name.Equals("Scale Bar")) as ScaleBar;&lt;BR /&gt; &lt;BR /&gt; northArrow.IsVisible = true;&lt;BR /&gt; northArrow.SetWidth(5);&lt;BR /&gt; northArrow.SetX(northArrow.GetX() - 1.30);&lt;BR /&gt; northArrow.SetY(northArrow.GetY() + 1.70);&lt;/P&gt;&lt;P&gt;scaleBar.IsVisible = true;&lt;BR /&gt; scaleBar.SetWidth(5);&lt;BR /&gt; scaleBar.SetX(scaleBar.GetX() + 1.30);&lt;BR /&gt; scaleBar.SetY(scaleBar.GetY() + 2);&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Surya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Dec 2017 11:34:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/i-want-to-create-a-new-layout-programatically-in/m-p/808447#M2277</guid>
      <dc:creator>SuryakantUpadhayay</dc:creator>
      <dc:date>2017-12-01T11:34:27Z</dc:date>
    </item>
  </channel>
</rss>

