<?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: Using ArcPy to move a scalebar in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675260#M52259</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neither saving nor using arcpy.RefreshActiveView after the posted code seems to make a difference. That said, there's no errors either. RefreshActiveView returns&amp;nbsp;&amp;lt;function RefreshActiveView at 0x255B32B0&amp;gt; which seems ok.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 Sep 2017 20:14:50 GMT</pubDate>
    <dc:creator>SimonWebster1</dc:creator>
    <dc:date>2017-09-17T20:14:50Z</dc:date>
    <item>
      <title>Using ArcPy to move a scalebar</title>
      <link>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675258#M52257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm looking to shift a scale bar with Python, and as such have a small proof of concept script happening in a python console window. Using the below code, no matter the location given with elementPositionY, the scale bar does not seem to change location at all.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;My current mxd&amp;nbsp;has a single scale bar named "ScaleBar1"&lt;/LI&gt;&lt;LI&gt;My data frame has a geographic coordinate system set (not sure if this matters).&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;I'm attempting to access the scale bar this way because ultimately I'll extend the for and if statements to work with multiple bars and some logic.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;I'm not a python coder, so please be gentle.&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code:&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;mxd = arcpy.mapping.MapDocument(r"C:\users\I5-Desktop\Documents\untitled.mxd") #current mxd&lt;BR /&gt;scaleBar = arcpy.mapping.ListLayoutElements(mxd,"MAPSURROUND_ELEMENT","ScaleBar1") #enforce working on "ScaleBar1". Can use wildcards when we have more.&lt;BR /&gt;for item in scaleBar:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;print item.name #confirm that we are working on the only scalebar that's currently in the document&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if item.name == "ScaleBar1":&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;item.elementPositionY = 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print item.name #reconfirm we have entered the if statement with the name&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;What reason might there be for the scalebar not changing location? I can resolve its name, and enter a loop based on its name, etc.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Sep 2017 11:08:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675258#M52257</guid>
      <dc:creator>SimonWebster1</dc:creator>
      <dc:date>2017-09-17T11:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using ArcPy to move a scalebar</title>
      <link>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675259#M52258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;everything points to &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/graphicelement-class.htm"&gt;saving the mxd &lt;/A&gt;since you aren't working with 'CURRENT', otherwise, there arcpy.RefreshActiveView&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Sep 2017 12:41:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675259#M52258</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-09-17T12:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using ArcPy to move a scalebar</title>
      <link>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675260#M52259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neither saving nor using arcpy.RefreshActiveView after the posted code seems to make a difference. That said, there's no errors either. RefreshActiveView returns&amp;nbsp;&amp;lt;function RefreshActiveView at 0x255B32B0&amp;gt; which seems ok.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Sep 2017 20:14:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675260#M52259</guid>
      <dc:creator>SimonWebster1</dc:creator>
      <dc:date>2017-09-17T20:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using ArcPy to move a scalebar</title>
      <link>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675261#M52260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you need... RefreshActiveView()&amp;nbsp; # the brackets&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Sep 2017 23:05:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675261#M52260</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-09-17T23:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using ArcPy to move a scalebar</title>
      <link>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675262#M52261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Although this didn't work for me in this instance, I need to learn where I require brackets and where I don't. Rookie error. Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As it turns out, and for whatever reason, I needed to be using CURRENT and not a reference to the mxd. The brackets were similarly important.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, the working code is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;mxd = arcpy.mapping.MapDocument("CURRENT") #current mxd&lt;/SPAN&gt;&lt;BR style="background-color: #f6f6f6;" /&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;scaleBar = arcpy.mapping.ListLayoutElements(mxd,"MAPSURROUND_ELEMENT","ScaleBar1") #enforce working on "ScaleBar1". Can use wildcards when we have more.&lt;/SPAN&gt;&lt;BR style="background-color: #f6f6f6;" /&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;for item in scaleBar:&lt;/SPAN&gt;&lt;BR style="background-color: #f6f6f6;" /&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;print item.name #confirm that we are working on the only scalebar that's currently in the document&lt;/SPAN&gt;&lt;BR style="background-color: #f6f6f6;" /&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if item.name == "ScaleBar1":&lt;/SPAN&gt;&lt;BR style="background-color: #f6f6f6;" /&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;item.elementPositionY = 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.RefreshActiveView()&lt;/SPAN&gt;&lt;BR style="background-color: #f6f6f6;" /&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print item.name #reconfirm we have entered the if statement with the name&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Sep 2017 08:26:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675262#M52261</guid>
      <dc:creator>SimonWebster1</dc:creator>
      <dc:date>2017-09-18T08:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using ArcPy to move a scalebar</title>
      <link>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675263#M52262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As suspected... glad it worked out&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Sep 2017 00:06:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-arcpy-to-move-a-scalebar/m-p/675263#M52262</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-09-19T00:06:42Z</dc:date>
    </item>
  </channel>
</rss>

