AnsweredAssumed Answered

ArcGIS 10.3.x Python tool script - Error for required parameters when disabled

Question asked by ftonini_msugis on Jun 28, 2016
Latest reply on Jun 30, 2016 by ftonini_msugis

In the python script tool I am programming (see code below), I am using a simple boolean checkbox to enable/disable certain parameters in the script GUI. However, even though the parameters get disabled correctly (greyed out, see screen capture), when I add points to my featureSet parameter interactively and click on OK to run, I receive error 000735 that the parameters I disabled are "required", impeding the run.


Is there any workaround to having to set inTable, X_field, and Y_field as "Optional"? In other words, can those 3 appear as Required and be correctly disabled without impeding script execution?




# Import all necessary module dependencies
import arcpy

import os

import sys


arcpy.env.overwriteOutput = True
arcpy.env.outputCoordinateSystem = arcpy.SpatialReference(3857)


def DrawSystems():


   # Local variable:
   out_layer = "Systems_lyr"

   # Get the value of the input parameter
   isChecked = arcpy.GetParameter(0)

  inTable = arcpy.GetParameterAsText(1)

  X_field = arcpy.GetParameterAsText(2)

  Y_field = arcpy.GetParameterAsText(3)

  inFeatureSet = arcpy.GetParameterAsText(4)


  arcpy.SetProgressorLabel('Creating System Components ...')

  arcpy.AddMessage('Creating System Components ...')


   if isChecked == False:


       if inTable or inTable != "#":


              # Process: Make XY Event Layer (temporary)
                                                                                 in_x_field=X_field, in_y_field=Y_field,

           except Exception:

               e = sys.exc_info()[1]

               arcpy.AddError('An error occurred: {}'.format(e.args[0]))



       if inFeatureSet or inFeatureSet != "#":


               # Process: Make Feature Layer (temporary)
               arcpy.MakeFeatureLayer_management(in_features=inFeatureSet, out_layer=out_layer)

           except Exception:

              e = sys.exc_info()[1]

             arcpy.AddError('An error occurred: {}'.format(e.args[0]))  # Process: Create Feature Class from Feature Layer

          #### Create Feature Class & Add Coordinates ####

              # Process: Copy Feature Class
              outSystems_fc = os.path.join(arcpy.env.scratchGDB, "Systems")

              outFC = arcpy.CopyFeatures_management(out_layer, outSystems_fc)


              arcpy.SetProgressorLabel('Adding XY Coordinates ...')

              arcpy.AddMessage('Adding XY Coordinates ...')


              # Process: Add Coordinates


              arcpy.AddIDMessage("ERROR", 930)


  #### Set Parameters ####

arcpy.SetParameter(5, outFC)


if __name__ == '__main__':