<?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: Layout Element Dimensions in Arcpy in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/layout-element-dimensions-in-arcpy/m-p/1329052#M73090</link>
    <description>&lt;P&gt;I logged a defect with ESRI and received the following response:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp;I have spoken with some colleagues and it appears that we cannot increase the significant figures used in the output when using ArcPy. I have logged an enhancement to allow for this so that we can get consistent results whether we are working with Python or in the UI. Below is some more information on the defect.&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Enhancement Number:&amp;nbsp;ENH-000161348&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Synopsis:&amp;nbsp;Allow for the ability to increase the precision of the element height, width, and XY position when using ArcPy.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Sep 2023 13:14:53 GMT</pubDate>
    <dc:creator>JohnButcher</dc:creator>
    <dc:date>2023-09-15T13:14:53Z</dc:date>
    <item>
      <title>Layout Element Dimensions in Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/layout-element-dimensions-in-arcpy/m-p/1325585#M72774</link>
      <description>&lt;P&gt;I have a question regarding layout element dimensions (in this case a MAP_FRAME element) and how decimal places are represented when extracting this information using arcpy.&lt;/P&gt;&lt;P&gt;I'm using Pro 2.9.5&lt;/P&gt;&lt;P&gt;Here is a screenshot showing the dimensions of my map frame:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohnButcher_0-1693940643053.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79888i0D2A8BE376A8DFB6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohnButcher_0-1693940643053.png" alt="JohnButcher_0-1693940643053.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here's a simplified snippet of code:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;import arcpy&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;prj = arcpy.mp.ArcGISProject("CURRENT")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;lyt = mxd.listLayouts()[0]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;frame = layout.listElements("MAPFRAME_ELEMENT","Map Frame")[0]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;print(frame.elementWidth)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;print(frame.elementHeight)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;print(frame.elementPositionX)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;print(frame.elementPositionY)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;3.31&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;2.37&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;0.25&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;7.5&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;As you can see the results are truncating at 2 decimal places. This is tripping me up as I try to place layout elements with precision.&lt;/P&gt;&lt;P&gt;I've tried a few things like "round()" and importing the decimal module but haven't had any success.&lt;/P&gt;&lt;P&gt;Any sense of what's happening here and how I might be able to return values that reflect the precise dimensions of the element?&lt;/P&gt;&lt;P&gt;Appreciate the help.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 19:24:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/layout-element-dimensions-in-arcpy/m-p/1325585#M72774</guid>
      <dc:creator>JohnButcher</dc:creator>
      <dc:date>2023-09-05T19:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Element Dimensions in Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/layout-element-dimensions-in-arcpy/m-p/1325600#M72777</link>
      <description>&lt;P&gt;See if it is just your default format settings by being specific about your format&lt;/P&gt;&lt;LI-CODE lang="python"&gt;frame_elementWidth = 3.3125  # a test variable

print("{:6.6f}".format(frame_elementWidth))
3.312500

print("{:6.4f}".format(frame_elementWidth))
3.3125

print("{:6.2f}".format(frame_elementWidth))
  3.31&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Sep 2023 19:45:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/layout-element-dimensions-in-arcpy/m-p/1325600#M72777</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-09-05T19:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Element Dimensions in Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/layout-element-dimensions-in-arcpy/m-p/1325616#M72778</link>
      <description>&lt;P&gt;Hi Dan, thanks a lot for the reply.&lt;/P&gt;&lt;P&gt;Using your recommended format options on both the frame element and a test variable the following values are returned.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;frame = layout.listElements("MAPFRAME_ELEMENT","Map Frame")[0]
print("{:6.6f}".format(frame.elementWidth))
3.310000
print("{:6.4f}".format(frame.elementWidth))
3.3100
print("{:6.2f}".format(frame.elementWidth))
3.31

frame_elementWidth = 3.3125 # test variable
print("{:6.6f}".format(frame_elementWidth))
3.312500
print("{:6.4f}".format(frame_elementWidth))
3.3125
print("{:6.2f}".format(frame_elementWidth))
3.31&lt;/LI-CODE&gt;&lt;P&gt;You mentioned default format settings. Is that something I can adjust?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 20:29:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/layout-element-dimensions-in-arcpy/m-p/1325616#M72778</guid>
      <dc:creator>JohnButcher</dc:creator>
      <dc:date>2023-09-05T20:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Element Dimensions in Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/layout-element-dimensions-in-arcpy/m-p/1325633#M72779</link>
      <description>&lt;P&gt;It is hard to say whether it is your IDE or that is the way it outputs the result.&amp;nbsp; If it is the latter, you should forward this as an issue with tech support, since the help states that a double is returned,.... not a truncated double&lt;/P&gt;&lt;P&gt;As for in general...&lt;/P&gt;&lt;P&gt;I know you can in scripts using numpy, but in plain python, you have to be overt in your decisions... see&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.python.org/3/tutorial/inputoutput.html" target="_blank" rel="noopener"&gt;7. Input and Output — Python 3.11.5 documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;for other options.&lt;/P&gt;&lt;P&gt;If you use numpy therre is a setprintoptions method. which enables you to handle boolean, float, list and array formatting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ft = {"bool": lambda x: repr(x.astype(np.int32)),
      "float_kind": '{: 6.2f}'.format}
np.set_printoptions(
    edgeitems=10, linewidth=120, precision=3, suppress=True, threshold=200,
    formatter=ft
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check your python IDE... there may be a setting option there&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 20:50:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/layout-element-dimensions-in-arcpy/m-p/1325633#M72779</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-09-05T20:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Element Dimensions in Arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/layout-element-dimensions-in-arcpy/m-p/1329052#M73090</link>
      <description>&lt;P&gt;I logged a defect with ESRI and received the following response:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp;I have spoken with some colleagues and it appears that we cannot increase the significant figures used in the output when using ArcPy. I have logged an enhancement to allow for this so that we can get consistent results whether we are working with Python or in the UI. Below is some more information on the defect.&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Enhancement Number:&amp;nbsp;ENH-000161348&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Synopsis:&amp;nbsp;Allow for the ability to increase the precision of the element height, width, and XY position when using ArcPy.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 13:14:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/layout-element-dimensions-in-arcpy/m-p/1329052#M73090</guid>
      <dc:creator>JohnButcher</dc:creator>
      <dc:date>2023-09-15T13:14:53Z</dc:date>
    </item>
  </channel>
</rss>

