I created a script tool in ArcMap 10.5. How do I set an output parameter from a tool in the script as an input parameter in another tool at a later point in the same script? Like:
buffout = arcpy.GetParameterAsText(5) # Feature class output of buffer analysis- THIS IS THE VARIABLE I GET AS OUTPUT THAT I WILL LATER USE AS INPUT
buff_dist = arcpy.GetParameterAsText(6) # Buffer distance parameter
# Run the Buffer Analysis tool on stream feature
arcpy.Buffer_analysis(outfc, buffout, buff_dist)
try:
# Add Parameters
outrast = arcpy.GetParameterAsText(7) # Output raster dataset clipped to stream buffer polygons
# Run the clip tool on hillshade using "buffout" variable as output extent
arcpy.Clip_management(outpath, "", outrast, buffout, "", "ClippingGeometry", 'NO_MAINTAIN_EXTENT')
# Add a success message
arcpy.AddMessage("Clipping of hillshade to buffer output successful!")
except:
# Report any error messages that the Buffer tool might have generated
arcpy.AddMessage(arcpy.GetMessage(0))
I want "buffout", the output from arcpy.Buffer_analysis()
step, to be used as an input parameter in arcpy.Clip_analysis()
.
Do I define buffout as arcpy.SetParameterAsText()?
If so, how and where do I use arcpy.SetParameterAsText() in my script to accomplish my purpose?
I don't understand that function very well.
Also, I'm assuming I must set buffout as a "Derived" parameter type in the script tool properties after using arcpy.SetParameterAsText() correctly?