I got the following error
Traceback (most recent call last):
File "<string>", line 110, in execute
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\topographic.py", line 1886, in PolygonToCenterline
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\topographic.py", line 1883, in PolygonToCenterline
retval = convertArcObjectToPythonObject(gp.PolygonToCenterline_topographic(*gp_fixargs((in_features, out_feature_class, connecting_features), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Failed to execute (PolygonToCenterline). " when running arcpy.topographic.PolygonToCenterline() in my code.
Line 110 is:
arcpy.topographic.PolygonToCenterline(dissolve_doors, door_lines, None)
the whole block of code is:
def execute(self, parameters, messages
"""The source code of the tool."""
door_layer = parameters[0].valueAsText
door = parameters[1].valueAsText
outFC = parameters[2].valueAsText
# memory delete
arcpy.Delete_management("memory")
#output location
arcpy.AddMessage(outFC)
arcpy.AddMessage(door)
#spatial reference
spatial_reference = arcpy.Describe(door_layer).spatialReference
#multi to single
single_doors = 'memory\\single_doors'
arcpy.management.MultipartToSinglepart(door_layer, single_doors)
#buffer
buffer_doors = 'memory\\buffer_doors'
arcpy.analysis.Buffer(single_doors, buffer_doors, "0.1 Feet","FULL","ROUND","NONE",None,"PLANAR")
floor_list =['xyz']
for item in floor_list:
#select by attribute
floor_id = "FLOOR_ID = '"+ item + "'"
arcpy.AddMessage(floor_id)
door_selection = arcpy.management.SelectLayerByAttribute(buffer_doors, "NEW_SELECTION", floor_id, None)
#dissolve doors
dissolve_doors = 'memory\\dissolve_doors'
arcpy.management.Dissolve(door_selection, dissolve_doors, None, None, "SINGLE_PART", "DISSOLVE_LINES", "")
#polygon to centerline
door_lines = 'memory\\door_lines2'
arcpy.topographic.PolygonToCenterline(dissolve_doors, door_lines, None)
The weird thing is, it runs fine step by step in the Python window.
Anyone know if something is wrong with code? Thing this might be a bug @esri