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\Datos\20140826\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?


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.


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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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