Filtering Simple Edge in Python toolbox

256
3
12-17-2020 06:35 PM
AzinSharaf
Occasional Contributor II

I am writing a Python toolbox. I have an input parameter which should accept a Simple Edge (part of Geometric Network) or a polyline feature class (no edge).

How can I use the Filter list so it can see both Simple Edge and Polyline feature class types? It looks like the filter doesn't work with simple edge. 

param2 = arcpy.Parameter(
displayName="Gravity Main Links",
name="fcLink",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input")

# if I comment out this line it sees the simple edge
# but it shows all types of feature classes. I just need to see
polylines
param2.filter.list = ["Polyline"]

 

Tags (1)
0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

You have simple edge in featureclasses as a featuretype

FeatureClass properties—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos
AzinSharaf
Occasional Contributor II

Thank you for the response but how can it be used as Filter Type? I don't see any option for simple edge in filter type.

Applying filters to a parameter 

0 Kudos
DanPatterson
MVP Esteemed Contributor

Test for its type

import arcpy
fc = r"C:\arcpro_npg\npg\Project_npg\npgeom.gdb\Polylines"
desc = arcpy.da.Describe(fc)
fc_type = desc['featureType']

if fc_type == 'Simple':
    print("do stuff")
else:
    print("not the right type")
    
do stuff

if fc_type == 'SimpleEdge':
    print("do stuff")
else:
    print("not the right type")
    
not the right type

... sort of retired...
0 Kudos