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

SCRIPT TOOL ERROR - TRYING TO GET USER TO SPECIFY TIME FRAME ON DATA FRAME

$
0
0
Layer time is only read access. in order to specify the data frame time (ie time slider options) I need to be able to have the user
select the time frame they would like. Data frame time has read and write access bc the funtions are specified via the time slider
window.

my question is not how to change the layer time bc that is not possible. I want the user to select the dataframetime (time slider)
but my GetParameterAsText format is obviously incorrect since I keep getting an error when I run the script.

which is: Traceback (most recent call last):
File "C:\Users\Courtney\Desktop\ScriptTool.py", line 233, in <module>
df.time.currentTime = arcpy.GetParameterAsText(6) #datetime.datetime(2009, 01, 1, 00, 00)
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\arcobjects\_base.py", line 92, in _set
(attr_name, self.__class__.__name__))
NameError: The attribute 'currentTime' is not supported on this instance of DataFrameTime.

Failed to execute (ScriptTool).


SCRIPT:
mxd = arcpy.mapping.MapDocument(arcpy.GetParameterAsText(0))
env.workspace = arcpy.GetParameterAsText(1)
df = arcpy.mapping.ListDataFrames(mxd)[0]

df.time.currentTime = arcpy.GetParameterAsText(2) #datetime.datetime(2009, 01, 1, 00, 00)
endTime = arcpy.GetParameterAsText(3) #datetime.datetime(2009, 01, 1, 23, 59)
interval = arcpy.GetParameterAsText(4) #arcpy.time.EsriTimeDelta(1, 'hours')
#or #interval = datetime.timedelta(hours=1)

Viewing all articles
Browse latest Browse all 2485

Trending Articles