import arcpy
import os
table = r"c:\temp\data.gdb\cg_sample1"
fcs = []
for row in arcpy.da.SearchCursor(table, ("CLASS")):
if not row[0] in fcs:
fcs.append(row[0])
print("> 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)