Select to view content in your preferred language

Table Frames in ArcGIS Pro layout

482
3
04-18-2024 10:39 PM
AnsgarG
Emerging Contributor

Hello, 

I'm trying to create a new Table Frame or update the existing one. For the caseof creating a Table Frame using CIM the project immideatly shuts down. I tried the following code:

p = arcpy.mp.ArcGISProject("current")
lyt = p.listLayouts("Layout")[0]
lyt_cim = lyt.getDefinition("V3")

tf = arcpy.cim.CreateCIMObjectFromClassName("CIMTableFrame", "V3")
tf.anchor = "BottomRightCorner"

lyt_cim.elements.append(tf)
lyt.setDefinition(lyt_cim)

 

For Updating the existing Table Frame i tried to set the table as fields like following code:

p = arcpy.mp.ArcGISProject("current")
m = p.listMaps("Map")[0]
table = m.addDataFromPath(r"path")

lyt = p.listLayouts("Layout")[0]
lyt_cim = lyt.getDefinition("V3")

for elm in lyt_cim.elements:
    if elm == "Table Frame":
        elm.fields = table
lyt.setDefinition(lyt_cim)

 

Any ideas why this isnt working? 

Tags (2)
0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

Was your example derived from

ArcGIS Pro 2.5 CIM Samples V1 - Overview

in the section for modifying tableframe objects? or was it examples in the cim folder, for example...

C:\...install path ...\Resources\ArcPy\arcpy\cim\CIMLayout.py

 


... sort of retired...
0 Kudos
AnsgarG
Emerging Contributor

I derived it, or rather i tried the same approach they have shown with their samples.

0 Kudos
AnsgarG
Emerging Contributor

Is it maybe because of missing table frame commands for the CIM Table Frame variable?

But which of these i have to set?
CIMTableFrame Class Properties 

0 Kudos