Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

PYT: Copy parameter

$
0
0
In a Python Toolbox, I ask the user for 2 parameters, an input and output mxd:

Code:

    def getParameterInfo(self):
        """Define parameter definitions"""

        param0 = arcpy.Parameter(
            displayName="Input ArcMap Document",
            name="in_mxd",
            datatype="DEMapDocument",
            parameterType="Required",
            direction="Input")

        param1 = arcpy.Parameter(
            displayName="Output ArcMap Document",
            name="out_mxd",
            datatype="DEMapDocument",
            parameterType="Required",
            direction="Output")

After the user selects the first, I'd like to copy the input mxd path to the second parameter, something like this:

c:\temp\test.mxd

c:\temp\testCopy.mxd

I'm working in updateParameters, without success:

Code:

    def updateParameters(self, parameters):
        """Modify the values and properties of parameters before internal
        validation is performed.  This method is called whenever a parameter
        has been changed."""

        if self.params[0].value:
            self.params[1].value = self.params[0].value

        return

Thanks,
Glen

Viewing all articles
Browse latest Browse all 2485

Latest Images

Trending Articles



Latest Images