I am trying to write a python script to take an existing featureclass that does not support Z or M values and enable enable them. I know that this cannot be done on an existing featureclass (why, I'm not sure!) so I wrote my script to create a new featureclass using the original as a template, then copy over all existing data, delete the original featureclass, then rename the new one to the original name. Sounds great, but the issue now is that if you create a featureclass using a featureclass that does not support Z values, the newly created one will also not support Z values, even is explicitly set to 'ENABLED' in the code. Does anyone know how this can be done, or if there is any errors in my code:
import arcpy from arcpy import env import os import datetime env.workspace = "database connections\BASE.sde\BASE.BASE.Test" Path = r"database connections\BASE.sde\BASE.BASE.Test\BASE.BASE." arcpy.env.overwriteOutput = True #Prompt user for FC to copy FC_Copy = raw_input("Enter Featureclass name to copy: ") #Copy original FC to a new '_Temp' FC arcpy.CreateFeatureclass_management(env.workspace, FC_Copy+"_Temp", "POLYLINE", Path + FC_Copy, "ENABLED", "ENABLED") print "Table " + FC_Copy + "_Temp added..." #Copy over existing data-how to ensure ObjectID's don't change? arcpy.Copy_management(Path + FC_Copy, Path + FC_Copy + "_Temp") print "Copied original records to " + FC_Copy + "_Temp..." #Delete original FC FC = Path + FC_Copy arcpy.Delete_management(FC) print "Original Table, " + FC + ", has been deleted..." #Rename copied FC to original name arcpy.Rename_management(Path + FC_Copy + "_Temp", FC_Copy) print "New Featureclass, " + FC_Copy + "_Temp, renamed to " + FC_Copy + ". Z-enabling script is completed successfully"