Need help with Python script, loop & adding values

329
3
08-06-2011 10:15 AM
RomySchroeder
New Contributor
Hello everybody,

I am currently working on a new tool for ArcGis 10. What I have done so far is to build a workflow combining different tools in the Model Builder.
Then I exportet it to a Python script.

Now, I want to add a few things to the script which can not be done in the Model Builder.
I am a beginner in Python and have difficulties with the next steps.
In the attached sketch I made a draft of how the tool should work.

1. How to implement a user-defined selection of the input features that should be analyzed, the user should be able to select the objects that should be analyzed

2. For every selected object an analysis will be performed inside a loop which should create a new output feature (shapefile), these result files should contain the ID of the selected input object as name;  (the analyzing process inside the loop is already done )

3. One or many field values from each output file should be added as a new field(s) to the input file

4. Non-selected objects in the input file should have a "0" in the new field

Anybody having ideas for that? A script example with some explanations would be very helpful for me an an Python beginner.
0 Kudos
3 Replies
RomySchroeder
New Contributor
Hi,

in the meantime I have figured out how to use a Search and an Update Cursor to acces the result values and write them into a new field of the input data. This works for a single result file. But how to do that for a whole list of files?

Also, I still need help with the user input. It should be possible for the user to select a number of object in a fb for wich the analysis should be done. Something like the mouse selction in ArcMap which then creates a list of features to loop through...

Any ideas?

Thank you,
Romy
0 Kudos
ShitijMehta
Esri Regular Contributor
0 Kudos
RomySchroeder
New Contributor
Hello Shitij,

thank you, I have tried Feature set and made a model with the model builder to test it.
It does work, but unfortunately not in the way I expected. Maybe I am doing something wrong?

I used it in ArcMap and defined a feature interactively, but what i got as a selection is a draws polygon (defined schema) and not an interactively selected EXISTING feature. I don´t know how to explain it, but please have a look at the attached image.

Can anybody help me with this, please.
Thank you, Romy.
0 Kudos