Is there a way to interact in a python script with manually selected feature ?

1863
2
10-24-2016 12:36 AM
VictorGuillot
New Contributor

Hello everyone,

I have to repeat hundreds of time the operation of selecting manually some points in a layer (can't make a script for that as the selection is not depending on location or attribute), and then save those points into a new layer, adding them a row and entering a value.

I tried to script it but it seams that the "apply to selected feature" in a python script only works for "in-script" previously selected feature and not for manually in map selected ones.

I also tried to add an add-in button, but at this point, I am totally unable to reach the goal.

At least I would like to be able to automatically save the selected points as a new layer in the database, without having to do everything "by-hand" as this operation will be repeated hundreds of time.

Thanks in advance for your interest,

Victor.

0 Kudos
2 Replies
DanPatterson_Retired
MVP Emeritus

Sounds like you want Creating a Python add-in tool—Help | ArcGIS for Desktop 

Knowing when to create a Python add-in

If it is required to make a customization that performs an action in response to an event, or requires the use of the mouse to interact with the display, you should consider making an add-in. An example is a tool that requires the user to click and drag a rectangle over a map to define an area of interest. Another example is an application extension that saves the map document automatically anytime a layer is added or removed from the table of content

check out some existing ones (not all may be interactive )

ArcGIS Code Sharing 

BenLeslie1
Occasional Contributor III

Python run in the arcmap python window acts on selected features.

You could write block of code and re-run it each time you select new features or, I assume writing a function and running it via the window would work too.