Below is my python script. So far I'm trying to import the feature classes into a topology. I don't know how to then add rules, and where to put that in the code. The script is returning the following: 'module' object has no attribute 'AddFeatureClassToTopology_management'
I'm new to python so any ideas, suggestions would be wonderful. Thank you very much.
import arcpyimport os# Set the workspacearcpy.env.workspace = r"D:\topology\Contours.gdb"# The name of the data_set containing the topologydata_set = "Contours"# The name of the topologytopology = "contour_topology"# Get the fully qualified name/path of the topologypath_topology = os.path.join(arcpy.env.workspace, data_set, topology)# Get the feature classes within the specified dataset feature_classes = arcpy.ListFeatureClasses(feature_dataset = data_set)# Check to make sure there are some feature classesif feature_classes is not None:# for each feature class for fc in feature_classes: # Get the fully qualified path to the feature class path_fc = os.path.join(arcpy.env.workspace, data_set, fc) # Try and add the feature class to the topology print(path_fc) print(fc) try: # add the feature class to the topology arcpy.AddFeatureClassToTopology_management(path_topology, path_fc, 1, 1) except Exception as e: # print any errors we might get print(e)
أكثر...
I'm new to python so any ideas, suggestions would be wonderful. Thank you very much.
import arcpyimport os# Set the workspacearcpy.env.workspace = r"D:\topology\Contours.gdb"# The name of the data_set containing the topologydata_set = "Contours"# The name of the topologytopology = "contour_topology"# Get the fully qualified name/path of the topologypath_topology = os.path.join(arcpy.env.workspace, data_set, topology)# Get the feature classes within the specified dataset feature_classes = arcpy.ListFeatureClasses(feature_dataset = data_set)# Check to make sure there are some feature classesif feature_classes is not None:# for each feature class for fc in feature_classes: # Get the fully qualified path to the feature class path_fc = os.path.join(arcpy.env.workspace, data_set, fc) # Try and add the feature class to the topology print(path_fc) print(fc) try: # add the feature class to the topology arcpy.AddFeatureClassToTopology_management(path_topology, path_fc, 1, 1) except Exception as e: # print any errors we might get print(e)
أكثر...