I made a script that works with a GDB, the script do the topology process with 8 rules to control, and at the end I have realised a exception of errors because all of datas generated in the GDB aren´t errors for example, dangles, then all of these process I have repeated for each element of topology and to add the 8 rules too.
I'am looking and trying to apply functions to perform my script, but I can´t understand on the whole how it work, I am new in the progamation but I think its is possible, I posted part of the script below. sorry for my english, Thanks again
Topology in 3 elements (cerca_l_Topolgia, rio_l_Topolgia, via_l_Topolgia ) repeat three times the same process in diferent elements.
## Define the DataSet and the FeatureClass
ds = DataSet , fc = FeatureClass ##
elif ds == "GS_ASOCIADO_A_POBLADOS" and fc == "cerca_l_Topolgia" :
input_dataset = ds
input_Fclass = fc
topo_name = "Planimetria_Topologia"
cluster_tol = 0.001
topoReglas = ["Must Not Overlap (Line)", "Must Not Intersect (Line)", "Must Not Have Dangles (Line)", "Must Not Have Pseudo-Nodes (Line)", "Must Not Self-Overlap (Line)","Must Not Self-Intersect (Line)","Must Not Intersect Or Touch Interior (Line)", "Must Be Single Part (Line)"]
validate = "true"
#Crear topologia de Planimetria
out_topo = arcpy.CreateTopology_management(input_dataset, topo_name, cluster_tol)
print("Created topology.")
#Añadir FeatureClass a la Topologia
arcpy.AddFeatureClassToTopology_management(out_topo, fc, 1, 1 )
print(arcpy.GetMessages())
arcpy.AddMessage("Iniciando Topología de Planimetría.")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[0], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[1], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[2], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[3], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[4], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[5], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[6], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[7], fc,"","","")
arcpy.AddMessage("Validando Topología de Planimetría")
arcpy.ValidateTopology_management(out_topo)
arcpy.AddMessage("Topología de Planimetría Finalizada.")
# Exportar errores de Planimetria
arcpy.ExportTopologyErrors_management(out_topo, ds, "Errores_Planimetria")
arcpy.AddMessage("Finalizado.")
#Topologia de Hidrografia
#Definicion de Variables
elif ds == "HO_AGUAS_INTERIORES" and fc == "rio_l_Topolgia":
input_dataset = ds
input_Fclass = fc
topo_name = "Hidrografia_Topology"
cluster_tol = 0.001
topoReglas = ["Must Not Overlap (Line)", "Must Not Intersect (Line)", "Must Not Have Dangles (Line)", "Must Not Have Pseudo-Nodes (Line)", "Must Not Self-Overlap (Line)","Must Not Self-Intersect (Line)","Must Not Intersect Or Touch Interior (Line)", "Must Be Single Part (Line)"]
validate = "true"
#Crear topologia de Hidrografia
out_topo = arcpy.CreateTopology_management(input_dataset, topo_name, cluster_tol)
print("Created topology.")
#Añadir FeatureClass a la Topologia
arcpy.AddFeatureClassToTopology_management(out_topo, fc, 1, 1 )
print(arcpy.GetMessages())
arcpy.AddMessage("Iniciando Topología de Hidrografia.")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[0], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[1], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[2], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[3], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[4], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[5], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[6], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[7], fc,"","","")
arcpy.AddMessage("Validando Topología de Hidrografía")
arcpy.ValidateTopology_management(out_topo)
arcpy.AddMessage("Topología de Hidrografía Finalizada.")
# Exportar errores de Hidrografia
arcpy.ExportTopologyErrors_management(out_topo, ds, "Errores_Hidrografia")
arcpy.AddMessage("Finalizado.")
#Topologia de Vialidad
#Definicion de Variables
elif ds == "IT_TRANSPORTE_TERRESTRE" and fc == "via_l_Topolgia":
input_dataset = ds
input_Fclass = fc
topo_name = "Vialidad_Topology"
cluster_tol = 0.001
topoReglas = ["Must Not Overlap (Line)", "Must Not Intersect (Line)", "Must Not Have Dangles (Line)", "Must Not Have Pseudo-Nodes (Line)", "Must Not Self-Overlap (Line)","Must Not Self-Intersect (Line)","Must Not Intersect Or Touch Interior (Line)", "Must Be Single Part (Line)"]
validate = "true"
#Crear topologia de Vialidad
out_topo = arcpy.CreateTopology_management(input_dataset, topo_name, cluster_tol)
#Añadir FeatureClass a la Topologia
arcpy.AddFeatureClassToTopology_management(out_topo, fc, 1, 1 )
print(arcpy.GetMessages())
arcpy.AddMessage("Iniciando Topología de Vialidad.")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[0], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[1], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[2], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[3], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[4], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[5], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[6], fc,"","","")
arcpy.AddRuleToTopology_management(out_topo, topoReglas[7], fc,"","","")
arcpy.AddMessage("Validando Topología de Vialidad")
arcpy.ValidateTopology_management(out_topo)
#print(arcpy.GetMessages())
arcpy.AddMessage("Topología de Vialidad Finalizada.")
# Exportar errores de Vialidad
arcpy.ExportTopologyErrors_management(out_topo, ds, "Errores_Vialidad")
arcpy.AddMessage("Finalizado.")