<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to use defined parameters in a tool ? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700966#M54309</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Adam for the tips ! I'm going to take a look &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Aug 2014 13:16:58 GMT</pubDate>
    <dc:creator>CARMETSandrine</dc:creator>
    <dc:date>2014-08-07T13:16:58Z</dc:date>
    <item>
      <title>How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700956#M54299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm very new at python, and I don't understand how to use the defined parameters in the source code of the tool. &lt;/P&gt;&lt;P&gt;I'm trying to create a tool (with clip and contour tools) who can be used by any user (not specified folders or classes). My script is in attachment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can somebody take a look ? :S&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 11:15:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700956#M54299</guid>
      <dc:creator>CARMETSandrine</dc:creator>
      <dc:date>2014-08-07T11:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700957#M54300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;InRaster = arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;Output = arcpy.GetParameterAsText(1)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 11:34:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700957#M54300</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-08-07T11:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700958#M54301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;humm this is not the answer that I was looking for...But thanks for answering me back &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I start my script, there is an Error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 88, in execute&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py", line 12021, in Clip&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/P&gt;&lt;P&gt;ExecuteError: ERROR 999999: Error executing function.&lt;/P&gt;&lt;P&gt;Failed to execute (Clip)."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So how can I get the extent from my shapefile to make my clip tool work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.Clip_management(RasterWorkspace + "\\" + RasterFile, "#", RasterWorkspace + "\\" + OutRasterFile, inputWorkspace + "\\" + ShapeFileName + ".shp", "0", "ClippingGeometry")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 11:44:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700958#M54301</guid>
      <dc:creator>CARMETSandrine</dc:creator>
      <dc:date>2014-08-07T11:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700959#M54302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sol, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes I've already done that. But the problem is that I want to generalize my script, so that the user of my tool will be able to choose is own shapefile (for extent to the clip tool) and his raster file. But I can't find the properly form to insert my parameters in my tool. &lt;/P&gt;&lt;P&gt;Can you have a look to my script in attachment above, to see if you have any ideas ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for helping.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 12:29:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700959#M54302</guid>
      <dc:creator>CARMETSandrine</dc:creator>
      <dc:date>2014-08-07T12:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700960#M54303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition to the export out of a model you could print the variables you put in the clip tool to see if there's something wrong:&lt;/P&gt;&lt;P&gt;arcpy.AddMessage(RasterWorkspace + "\\" + RasterFile) ......&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 12:35:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700960#M54303</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-08-07T12:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700961#M54304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The messages didn't show me something wrong.&lt;/P&gt;&lt;P&gt;It seems that the problem come from the shapefile (inputWorkspace + "\\" + ShapeFileName + ".shp")&amp;nbsp; that I used as an extent for the Clip tool.&lt;/P&gt;&lt;P&gt;Maybe I should use an other function to obtain the extent values from the shapefile, and then put it directly in the clip tool. But I don't know how to do that... I'm going to continue my research.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 12:54:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700961#M54304</guid>
      <dc:creator>CARMETSandrine</dc:creator>
      <dc:date>2014-08-07T12:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700962#M54305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As I can see it's all OK, so I don't know what could be wrong.&lt;/P&gt;&lt;P&gt;It's quite sophisticated what you are doing. Twice the use of parameters[0].valueAsText? One time .valueastext = not correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would try to put the shape in the clip syntax hard coded, to see if it works?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 13:02:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700962#M54305</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-08-07T13:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700963#M54306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for the advice Sol, &lt;/P&gt;&lt;P&gt;I'm going to see if they can help me in the python forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sandrine &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 13:06:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700963#M54306</guid>
      <dc:creator>CARMETSandrine</dc:creator>
      <dc:date>2014-08-07T13:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700964#M54307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;These links should help: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create the custom script tool and define the input parameters via the Add Script Tool Wizard.&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Adding_a_script_tool/00150000001r000000/" title="http://resources.arcgis.com/en/help/main/10.1/index.html#/Adding_a_script_tool/00150000001r000000/"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#/Adding_a_script_tool/00150000001r000000/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Access the input parameters and plug them into your Clip_management code:&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Accessing_parameters_in_a_script_tool/001500000007000000/" title="http://resources.arcgis.com/en/help/main/10.1/index.html#/Accessing_parameters_in_a_script_tool/001500000007000000/"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#/Accessing_parameters_in_a_script_tool/001500000007000000/&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 13:07:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700964#M54307</guid>
      <dc:creator>AdamFeidt</dc:creator>
      <dc:date>2014-08-07T13:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700965#M54308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I went to far with my script by trying things. I'm going to simplify it as possible.&lt;/P&gt;&lt;P&gt;For the clip, I'll try what you say to see if it works ! &lt;/P&gt;&lt;P&gt;Thankss Johannes!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 13:14:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700965#M54308</guid>
      <dc:creator>CARMETSandrine</dc:creator>
      <dc:date>2014-08-07T13:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700966#M54309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Adam for the tips ! I'm going to take a look &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 13:16:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700966#M54309</guid>
      <dc:creator>CARMETSandrine</dc:creator>
      <dc:date>2014-08-07T13:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700967#M54310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not helpful to the problem, but just curious why the choice for a python toolbox.&lt;BR /&gt;I just haven't found a reason to do this yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am currently looking into your problem though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 14:13:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700967#M54310</guid>
      <dc:creator>ToddUlery</dc:creator>
      <dc:date>2014-08-07T14:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700968#M54311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I create this python toolbox to facilitate a big number of tasks by automating a sucession of tools. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I find out the solution thanks to all for your advices.&lt;/P&gt;&lt;P&gt;I was just complicating myself with a tons of parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks everyone! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 14:27:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700968#M54311</guid>
      <dc:creator>CARMETSandrine</dc:creator>
      <dc:date>2014-08-07T14:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700969#M54312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree that Python toolboxes (.pyt) are not always the best choice -- and definitely not for beginners. I too have not found a compelling case to go there yet. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The main advantages I see as this point are 1) better capability in parameter validation (especially with complex parameter inputs like value tables and 2) a fully-python solution for people that are very fluent in that environment.&amp;nbsp; Some downsides include all the external files .pyt requires (each tool documentation is a separate XML file) and more difficult debugging (for most people).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I totally recommend you going back to the tbx way of doing it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 18:46:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700969#M54312</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-08-07T18:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use defined parameters in a tool ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700970#M54313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To get you started, have a look at the code below. Use this script by adding it as a script to a new toolbox.&lt;/P&gt;&lt;P&gt;Define the 5 parameters as explained on line 18 - 22&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14075185767137177" jivemacro_uid="_14075185767137177" modifiedtitle="true"&gt;
&lt;P&gt;#-------------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;# Name:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; clip_contour.py&lt;/P&gt;
&lt;P&gt;# Purpose:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; clip raster and create contours&lt;/P&gt;
&lt;P&gt;#&lt;/P&gt;
&lt;P&gt;# Author:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sandrine Carmet&lt;/P&gt;
&lt;P&gt;#&lt;/P&gt;
&lt;P&gt;# Created:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 08/08/2014&lt;/P&gt;
&lt;P&gt;#-------------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;class LicenseError(Exception):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;def main():&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; import os&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # read the parameters&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_extent = arcpy.GetParameterAsText(0) # define as featurelayer, filter polygon, direction input&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ras_in = arcpy.GetParameterAsText(1) # define as rasterlayer, direction input&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ras_clip = arcpy.GetParameterAsText(2) # define as raster dataset, direction output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_contour = arcpy.GetParameterAsText(3) # define as featureclass, direction output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; interval = arcpy.GetParameter(4) # define as Double, set min and max range, provide default&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # configuration of contours&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; contour_interval = interval # not 4...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; base_contour = 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; z_factor = 1&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.CheckExtension("3D") == "Available":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CheckOutExtension("3D")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # raise exception&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise LicenseError&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # set in memory workspace&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = "IN_MEMORY"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Determine the extent of the fc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extent = arcpy.Describe(fc_extent).extent&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext_txt = "{0} {1} {2} {3}".format(extent.XMin, extent.YMin, extent.XMax, extent.YMax)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Clip the raster&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management(ras_in, ext_txt, ras_clip, fc_extent, "#", "ClippingGeometry")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create the contours&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Contour_3d(ras_clip, fc_contour, contour_interval, base_contour, z_factor)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # return license&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CheckInExtension("3D")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # outputs are automatically added to the TOC...&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; except LicenseError:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("3D Analyst license is unavailable")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; except arcpy.ExecuteError:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(arcpy.GetMessages(2))&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;if __name__ == '__main__':&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you run the script successfully, you can go to the Results windows and see the syntax for executing the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_1407518956039681" jivemacro_uid="_1407518956039681"&gt;
&lt;P&gt;# Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script&lt;/P&gt;
&lt;P&gt;# The following inputs are layers or table views: "pols", "DEMsmpro"&lt;/P&gt;
&lt;P&gt;arcpy.ClipRasterCreateContours("pols","DEMsmpro","D:/Xander/grd/test_clip","D:/Xander/tmp/test2.gdb/test_contours","50")&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could create another script that simply executes this script or change the script to work with a list of inputs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards, Xander&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2014 17:29:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-defined-parameters-in-a-tool/m-p/700970#M54313</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-08-08T17:29:39Z</dc:date>
    </item>
  </channel>
</rss>

