Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Adding drop down option for layers in Python script tool?

$
0
0

I’ve code that will add fields to feature classes. I’ve parameterized the script so the user can navigate to the location of the feature classes to be edited.

If the feature class is already open and in my data frame I want the option for the drop down to pick feature classes that are already open rather than having to navigate to the location of the files.

Does that require code being added to my script or is that something I can do in the script properties?

My code looks like this currently.

import arcpy

fc = arcpy.GetParametersAsText(0)

# Process: Add Field
arcpy.AddField_management(fc, "DATE_MOD", "DATE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")

# Process: Add Field
arcpy.AddField_management(fc, "DATE_ADDED", "DATE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")

# Process: Add Field
arcpy.AddField_management(fc, "MOD_BY", "TEXT", "", "", "50", "", "NULLABLE", "NON_REQUIRED", "")

# Process: Add Field
arcpy.AddField_management(fc, "ADDED_BY", "TEXT", "", "", "50", "", "NULLABLE", "NON_REQUIRED", "")

Viewing all articles
Browse latest Browse all 767

Trending Articles