<?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: RepairGeometry example 2 stand-alone script does not work in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1564040#M90744</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;- yes, the search cursor was called CLASS in my table as well.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Dec 2024 13:48:46 GMT</pubDate>
    <dc:creator>KatClifton</dc:creator>
    <dc:date>2024-12-03T13:48:46Z</dc:date>
    <item>
      <title>RepairGeometry example 2 stand-alone script does not work</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1563694#M90699</link>
      <description>&lt;P&gt;Attempted to use the RepairGeometry example 2 stand-alone script provided in Esri documentation to back up erroneous geometries and then repair them. Script fails on the CopyFeatures line, meaning that erroneous geometries are not able to be copied to another feature class before being corrected.&lt;/P&gt;&lt;P&gt;I did update the path to the table that was generated by the Check Geometry tool.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/3.3/tool-reference/data-management/repair-geometry.htm" target="_blank"&gt;Repair Geometry (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here is the sample script directly from the Esri documentation.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Description: 
#   Goes through the table generated by the Check Geometry tool and does 
#   the following
#   1) backs-up all features which will be 'fixed' to a "_bad_geom" feature class
#   2) runs repairGeometry on all feature classes listed in the table 

import arcpy
import os
 
# Table that was produced by Check Geometry tool
table = r"c:\temp\data.gdb\cg_sample1"
 
# Create local variables
fcs = []
 
# Loop through the table and get the list of fcs
for row in arcpy.da.SearchCursor(table, ("CLASS")):
    # Get the class (feature class) from the cursor
    if not row[0] in fcs:
        fcs.append(row[0])
 
# Now loop through the fcs list, backup the bad geometries into fc + "_bad_geom"
# then repair the fc
print("&amp;gt; Processing {0} feature classes".format(len(fcs)))
for fc in fcs:
    print("Processing " + fc)
    lyr = 'temporary_layer'
    if arcpy.Exists(lyr):
        arcpy.Delete_management(lyr)
    
    tv = "cg_table_view"
    if arcpy.Exists(tv):
        arcpy.Delete_management(tv)

    arcpy.MakeTableView_management(table, tv, ("\"CLASS\" = '%s'" % fc))
    arcpy.MakeFeatureLayer_management(fc, lyr)
    arcpy.AddJoin_management(lyr, arcpy.Describe(lyr).OIDFieldName, tv, "FEATURE_ID")
    arcpy.CopyFeatures_management(lyr, fc + "_bad_geom")
    arcpy.RemoveJoin_management(lyr, os.path.basename(table))
    arcpy.RepairGeometry_management(lyr)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following error is returned:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ExecuteError: ERROR 160144: An expected Field was not found or could not be retrieved properly.
Failed to execute (CopyFeatures).&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 02 Dec 2024 15:55:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1563694#M90699</guid>
      <dc:creator>KatClifton</dc:creator>
      <dc:date>2024-12-02T15:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: RepairGeometry example 2 stand-alone script does not work</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1563836#M90718</link>
      <description>&lt;P&gt;That is an example script.&amp;nbsp; Did you modify it's inputs to match your situation? (ie. featureclass name, field name)&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 20:45:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1563836#M90718</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-12-02T20:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: RepairGeometry example 2 stand-alone script does not work</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1563868#M90722</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;, yes I modified the script to read the input in my environment.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;In my original post I indicated that&amp;nbsp;&lt;SPAN&gt;I did update the path to the table that was generated by the Check Geometry tool.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 21:30:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1563868#M90722</guid>
      <dc:creator>KatClifton</dc:creator>
      <dc:date>2024-12-02T21:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: RepairGeometry example 2 stand-alone script does not work</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1563873#M90724</link>
      <description>&lt;P&gt;and the field name for the searchcursor?&amp;nbsp; Was it also called "CLASS"&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/searchcursor-class.htm" target="_blank"&gt;SearchCursor—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 21:44:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1563873#M90724</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-12-02T21:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: RepairGeometry example 2 stand-alone script does not work</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1564040#M90744</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;- yes, the search cursor was called CLASS in my table as well.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2024 13:48:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1564040#M90744</guid>
      <dc:creator>KatClifton</dc:creator>
      <dc:date>2024-12-03T13:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: RepairGeometry example 2 stand-alone script does not work</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1564058#M90747</link>
      <description>&lt;P&gt;Well that leaves the&amp;nbsp;.OIDFieldName&lt;/P&gt;&lt;P&gt;and the error message, which I assume you saw already&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/3.3/tool-reference/tool-errors-and-warnings/160001-170000/tool-errors-and-warnings-160126-160150-160144.htm" target="_blank" rel="noopener"&gt;160144: An expected field was not found or could not be retrieved properly.—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;only suggests one course of action, so I would contact Tech Support if your layer does have an object id name&lt;/P&gt;&lt;P&gt;or try adding a check to the code to test whether there is an OIDFieldName using 'hasOID' from the table properties method&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/3.3/arcpy/functions/table-properties.htm" target="_blank" rel="noopener"&gt;Table properties—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Tech Support may have other bug not listed below that return similar responses&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.esri.com/en-us/search?q=OIDFieldName&amp;amp;s=Newest&amp;amp;cardtype=support_bug_articles" target="_blank"&gt;Esri Support Search Results&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2024 14:22:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/repairgeometry-example-2-stand-alone-script-does/m-p/1564058#M90747</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-12-03T14:22:27Z</dc:date>
    </item>
  </channel>
</rss>

