I gave it a whirl but I can't seem to figure out the particular expression to test if the given variable is a geometry object (as if you had run a searchcursor for "Shape@"). I'm mostly just concerned with detecting that's it's a geometry object and not of what type (line, polyline, etc). I've tried things to the effect of:
if type(value) == 'arcpy.arcobjects.geometries.Polyline' (or 'Polyline' or 'arcpy.arcobjects.arcobjects.Geometry')
What's the magic word I'm looking for, for the right side of that expression?
Solved! Go to Solution.
The value you compare it to should be a type, not a string.
if type(value) in (arcpy.Polygon, arcpy.Point, arcpy.Polyline, arcpy.Multipoint):
arcpy.DoSomething(...)
It'd be nice if type(value) is arcpy.Geometry returned True, but sadly it doesn't.
The value you compare it to should be a type, not a string.
if type(value) in (arcpy.Polygon, arcpy.Point, arcpy.Polyline, arcpy.Multipoint):
arcpy.DoSomething(...)
It'd be nice if type(value) is arcpy.Geometry returned True, but sadly it doesn't.