<?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: Bookmarks not working after script with CIM objects in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/bookmarks-not-working-after-script-with-cim/m-p/1643613#M98360</link>
    <description>&lt;P&gt;I just realized, when I simply go to the last extent, the extent indicator in the overview map does not update.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Aug 2025 09:58:54 GMT</pubDate>
    <dc:creator>CordulaGöke</dc:creator>
    <dc:date>2025-08-20T09:58:54Z</dc:date>
    <item>
      <title>Bookmarks not working after script with CIM objects</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/bookmarks-not-working-after-script-with-cim/m-p/1643610#M98358</link>
      <description>&lt;P&gt;I have a script to adjust the scale bar and grid as CIM objects. After I ran this script, the manual use of bookmarks is not working anymore. I cannot set bookmarks nor zoom to existing bookmarks.&amp;nbsp; Do I need to release the CIM objects, update or something else? When I close and reopen the map, everything is fine. I need to go manually through all bookmarks before export.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 09:38:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/bookmarks-not-working-after-script-with-cim/m-p/1643610#M98358</guid>
      <dc:creator>CordulaGöke</dc:creator>
      <dc:date>2025-08-20T09:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Bookmarks not working after script with CIM objects</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/bookmarks-not-working-after-script-with-cim/m-p/1643613#M98360</link>
      <description>&lt;P&gt;I just realized, when I simply go to the last extent, the extent indicator in the overview map does not update.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 09:58:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/bookmarks-not-working-after-script-with-cim/m-p/1643613#M98360</guid>
      <dc:creator>CordulaGöke</dc:creator>
      <dc:date>2025-08-20T09:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Bookmarks not working after script with CIM objects</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/bookmarks-not-working-after-script-with-cim/m-p/1645568#M98533</link>
      <description>&lt;P&gt;If you could share a code snippet that might help.&amp;nbsp; Are you using "CURRENT" or a file path to define the project variable?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Aug 2025 13:19:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/bookmarks-not-working-after-script-with-cim/m-p/1645568#M98533</guid>
      <dc:creator>BrennanSmith1</dc:creator>
      <dc:date>2025-08-26T13:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Bookmarks not working after script with CIM objects</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/bookmarks-not-working-after-script-with-cim/m-p/1648194#M98745</link>
      <description>&lt;P data-unlink="true"&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/39515"&gt;@BrennanSmith1&lt;/a&gt;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt; good point&lt;/SPAN&gt; .&amp;nbsp; First I thought it had solved itself, but after I zoomed and ran the rescaling of scalebar and grid several times, zoom to bookmarks stopped working. Yes I use aprx = arcpy.mp.ArcGISProject("CURRENT") in a jupyter notebook. It is the first project where I zoom manually through bookmarks and I also added the update_grid() only recently.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import os
import pandas as pd

aprx = arcpy.mp.ArcGISProject("CURRENT")

arcpy.env.workspace = os.path.dirname(aprx.filePath)
arcpy.env.addOutputsToMap = False&lt;/LI-CODE&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;LI-CODE lang="python"&gt;def update_scalebar():
    # Get the layout's CIM definition
    lyt_cim = lyt.getDefinition("V3")
    mf_camera_scale = mf.camera.scale

    for elm in lyt_cim.elements:
        if elm.name == "Scale Bar":
            elm.unitLabel = "km"
            elm.labelFrequency = "Divisions"
            elm.division = round(mf_camera_scale / 80000, 0)
            elm.divisions = 2
            elm.subdivisions = 2

    # Apply the updated CIM definition back to the layout
    lyt.setDefinition(lyt_cim)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def update_grid():    
    mf_camera_scale=mf.camera.scale
    minute = 1 / 60
    # Standard intervals in degrees
    standard_intervals = [1, 2, 5, 10, 15, 30]  # in minutes
    standard_degrees = [m * minute for m in standard_intervals]
    
    # Estimate based on scale
    estimated_minutes = round(mf_camera_scale / 3000000 * 60) 
    estimated_degrees = estimated_minutes * minute
    
    # Find closest standard interval
    grid_interval = round(estimated_degrees,0)+min(standard_degrees, key=lambda x: abs(x - estimated_degrees))
    
    cim_lyt = lyt.getDefinition("V3")
    print(grid_interval)
    for elm in cim_lyt.elements:
        if elm.name == 'Map Frame':
            for grd in elm.grids:
                grd.isAutoScaled = False  # Ensure manual control
    
                for grdLn in grd.gridLines:
                    if grdLn.name == "Ticks":
                        if grdLn.gridLineOrientation == "EastWest":
                            grdLn.pattern.interval = grid_interval/2  # Latitude ticks
                        elif grdLn.gridLineOrientation == "NorthSouth":
                            grdLn.pattern.interval = grid_interval # Longitude ticks
                    if grdLn.name == "Labels":
                      if grdLn.gridLineOrientation == "EastWest":
                          grdLn.pattern.interval = grid_interval  # Latitude ticks
                      elif grdLn.gridLineOrientation == "NorthSouth":
                        grdLn.pattern.interval = grid_interval*2 # Longitude ticks
    
    lyt.setDefinition(cim_lyt)&lt;/LI-CODE&gt;&lt;LI-CODE lang="python"&gt;lyt = aprx.listLayouts('Layout')[0]
mf = lyt.listElements("MAPFRAME_ELEMENT",'Map Frame')[0]

map_obj = mf.map
update_scalebar()
update_grid()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2025 11:29:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/bookmarks-not-working-after-script-with-cim/m-p/1648194#M98745</guid>
      <dc:creator>CordulaGöke</dc:creator>
      <dc:date>2025-09-05T11:29:53Z</dc:date>
    </item>
  </channel>
</rss>

