0

I'm using 10.2.2 arcgis

I have the following script

import arcpy
mxd = arcpy.mapping.MapDocument ("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
addLayer = arcpy.mapping.Layer(r"C:\Users\Document\Geomarketing\Datos20140826円\rest\PG_Restaurantes_GT.shp")
arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")
del mxd, addLayer

The function of this script is to add a specific layer to my dataframe. I want to add this script into a model, my purpose is to have a checkbox to have the option to add or not to add the layer.

I am new to this and do not know what changes should I make to my script to let me do this in modelbuider.

Do I do this in my script?

Hornbydd
44.9k5 gold badges42 silver badges84 bronze badges
asked Nov 5, 2014 at 17:50

1 Answer 1

3

You will need to create a boolean variable and define it as a model parameter. This will add a check box option when double clicking on the model.

OR

Create a script tool that runs your code and has a boolean data type.

Either way you will have to check the boolean value using an if statement.

answered Nov 5, 2014 at 17:57

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.