palffygelfandk

use a selection of features in arcmap in python script

Discussion created by palffygelfandk on Jun 17, 2013
Latest reply on Jun 17, 2013 by palffygelfandk
Hi,
I am trying to write a python script and can't get over the first obstacle. I am on ArcMap 10.1.
I want for the user to select features in ArcMap and then use these selected features in a python script. Is there a way to do that?
Has somebody attempted that before and has some sample code?
The code that I tried does not use the selection, but the whole feature class instead. Please see code snippet below.

arcpy.AddMessage("Exporting selected features to working database...")
arcpy.MakeFeatureLayer_management(fc1,"fclyr")
arcpy.SetParameter(1,"fclyr")
fc2 = os.path.join(ws1,"Pipes")
arcpy.CopyFeatures_management("fclyr", fc2)

Your help would be appreciated.
Thanks!

Outcomes