1

I have a model that an ESRI associate sent me as an example. When I run the model everything is great. I click on the model and because the seleting features is a parameter, it automatically starts an edit session for me to digitize the selecting features. However when I convert this model to a script and try to run as a script, when I run it, the selecting feature parameter is not in edit mode, a polygon does not pop up in the table of contents as a feature class to be digitized like it was with the model. Is there a way to change the model so that the selecting features can be digitized ? Thanks

The first picture shows the model, the second shows the model when I run it, and the third shows the scrip when I run it.figure1figure2figure3

# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# toolbox_scrip3t.py
# Created on: 2013-09-30 13:13:52.00000
#   (generated by ArcGIS/ModelBuilder)
# Usage: toolbox_scrip3t <Selecting_Features> <value> 
# Description: 
# test
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy

# Script arguments
Selecting_Features = arcpy.GetParameterAsText(0)
if Selecting_Features == '#' or not Selecting_Features:
    Selecting_Features = "in_memory\\{44DC94EF-CABC-4233-A4AF-CEFD34618B2E}" # provide a default value if unspecified

value = arcpy.GetParameterAsText(1)

# Local variables:
Input_Points = "FirePerimeter"
Final_Output = value
Selected_Features = Selecting_Features
Input_Points_Layer = "SamplePoints_Layer"

# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(Input_Points, Input_Points_Layer, "", "", "OBJECTID OBJECTID VISIBLE NONE;SymbologyField SymbologyField VISIBLE NONE;DomainField DomainField VISIBLE NONE;Shape Shape VISIBLE NONE;Subtype Subtype VISIBLE NONE;EditField EditField VISIBLE NONE")

# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Input_Points_Layer, "INTERSECT", Selecting_Features, "", "NEW_SELECTION")

# Process: Calculate Field
arcpy.CalculateField_management(Selected_Features, "EditField", "'%value%'", "PYTHON_9.3", "")

closed as unclear what you're asking by Jason Scheirer, PolyGeo, Fezter, BradHards, Devdatta Tengshe Oct 1 '13 at 2:44

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Could you provide additional details as to what you want to do? It's a little unclear... if it does what you want in model builder why are you trying to export as a script? The script you posted isn't referencing any selection...so that would be my starting point. – GISKid Sep 30 '13 at 19:09
  • 1
    If the model already worked, why did you export to script? I'm a little confused at the entire premise of this question. – Jason Scheirer Sep 30 '13 at 19:33
  • Thanks for updating your code. You don't have your shapefile/input referenced at all. For instance you have "Input Points = "Fireperimeter" but that should reference a file like "C:\Shapes\Fireperimeter.shp" – GISKid Sep 30 '13 at 19:48
4

In answer to your question ...

Is there a way to change the model so that the selecting features can be digitized?

I recommend that you investigate using a Feature Set in ModelBuilder.

I think exporting your model to a Python script is just an attempt to develop an unnecessary workaround - but be sure to let us know if that is my misunderstanding.

  • I think you are right PolyGeo, I did that and it worked. Thanks!!! – ionara Oct 7 '13 at 21:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.