AnsweredAssumed Answered

Setting Script Tool Parameters - Python in ModelBuilder

Question asked by nmbauer on May 11, 2015
Latest reply on May 26, 2015 by dkwiens

Hi All,

 

I am wondering if you could help with following. Essentially it relates to the following help article "Setting Script Tool Parameters" ArcGIS Help (10.2, 10.2.1, and 10.2.2)

 

I have a used ModelBuilder to create a geoprocessing workflow. However for part of this I need to run a script within the model to dissolve some features within a layer (the inbuilt modelbuilder geoprocessing function for this does not give me multi-part polygons, despite this being a supposed option).

 

Thanks in advance (Using ArcGIS 10.2)

 

Nick

 

Essentially the problem I encounter is that when I run the model ArcGIS goes in to 'not responding mode' and does not recover. I suspect there is something wrong with wither my python script or the way I am passing variables between modelbuilder and my python script?

 

Python Script - Dissolve2

import arcpy

arcpy.env.workspace = "C:/Data/ArcGIS/Default.gdb/Dissolve1"

inLayer = arcpy.GetParameter(0)

outLayer = "C:/Data/ArcGIS/temp/OutDisolve.shp"

arcpy.Dissolve_management(inLayer, outLayer, "Id", "","MULTI_PART", "")

arcpy.SetParameter(1, OutLayer)

 

I have provided screenshots below

1. A simplified view of the model

Model.JPG

InLayer.JPGOutLayer.JPG

2. Parameter Input and Output

Outcomes