POST
|
Caleb, Thanks for taking the time to help. The explanations are extremely useful to a new python scipter, such as myself. Thanks.
... View more
07-29-2013
05:38 AM
|
0
|
0
|
451
|
POST
|
Caleb, This is the type of whereClause that I was attempting to build. But, was much more involved than I anticipated. Will you please explain the sql_dict, your whereClause statement, and how your traceback works? Thanks.
... View more
07-29-2013
04:13 AM
|
0
|
0
|
451
|
POST
|
Caleb, This is the type of where clause I was attempting to create. It was just more advanced than I anticipated. Can you explain the sql_dict, your whereClause statement, and the traceback? Thanks.
... View more
07-29-2013
03:54 AM
|
0
|
0
|
451
|
POST
|
All, The script is almost complete. I am attempting to have the user input the six values as strings, then the script selects and zooms to feature. I am running into a syntax error within the whereClause. Any suggestions as to why? #Import import arcpy #Variables TOWNSHIP = arcpy.GetParameterAsText(0) RANGE = arcpy.GetParameterAsText(1) SEC = arcpy.GetParameterAsText(2) SUBCODE = arcpy.GetParameterAsText(3) BLOCK = arcpy.GetParameterAsText(4) LOT = arcpy.GetParameterAsText(5) mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] lyr = arcpy.mapping.ListLayers(mxd, "Parcels", df)[0] #Logic try: whereClause = ""TOWNSHIP" AND "RANGE" AND "SEC" AND "SUBCODE" AND "BLOCK" AND "LOT" = '"+Parcels+"'" arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause) df.extent = lyr.getSelectedExtent() df.scale = df.scale*1.1 except: print arcpy.GetMessages()
... View more
07-26-2013
12:22 PM
|
0
|
8
|
556
|
POST
|
Matt, I was telling the script to enter the string "inputName". It would "inputName" into the attribute field, instead of the name entered. Thanks for your help.
... View more
07-25-2013
05:09 AM
|
0
|
0
|
278
|
POST
|
All, I need to modify my script to have the user's name entered into the MAPPER attribute field. Currently, the script enters inputName into the attribute field. I have a Parameter setup to Enter YOUR name as a string, but the script overwrites the name entered. I want the Enter YOUR Name string the value to be entered into the attribute table, not the inputName. My script is shown below. inputName is listed as the 2nd string, since this is only part of my script. I have another string set to 0. #Import import arcpy #Name Variable inputName = arcpy.GetParameterAsText(1) #Permits the user to enter their name into the MAPPER field try: cursor = arcpy.da.UpdateCursor("Parcels", ["MAPPER"]) for row in cursor: cursor.updateRow(["inputName"]) arcpy.AddMessage("name entered") del row del cursor except: print arcpy.GetMessages()
... View more
07-25-2013
04:43 AM
|
0
|
2
|
405
|
POST
|
James, you are the man. You deserve a nice cold beer. I greatly appreciate all of your guidance.
... View more
07-23-2013
11:50 AM
|
0
|
0
|
362
|
POST
|
James, After much frustration, I was finally able to convert some of my tools to buttons. Back, to the initial part of my search. Can you provide an example string that would ask the user to provide their name? I would like to have the value entered directly into a field in the attribute table. Or at least point in the correct direction with which function to use. Thanks again.
... View more
07-23-2013
11:33 AM
|
0
|
0
|
362
|
POST
|
James, If I create a toolbar with one button, how can I add more buttons later? Thanks.
... View more
07-23-2013
10:27 AM
|
0
|
0
|
362
|
POST
|
I got the button to work. But, in setting up the add-in, it seems to only work about 1 out of every 10 attempts. Any one else run into the same or similiar problems with creating python add-ins?
... View more
07-23-2013
10:05 AM
|
0
|
0
|
797
|
POST
|
I was able to add the button picture this time and return the print message. But, the pythonaddins.GPToolDialog still does not run. I believe the .exe fails when you attempt to change ID (Variable Names) for the toolbar/button.
... View more
07-23-2013
07:52 AM
|
0
|
0
|
797
|
POST
|
I double checked the toolbox path and it is fine. I included the latest suggestion, to add the message. Nothing. I have the toolbar name, but no picture or button name. But, if I only edit the script to incude the message and accept all other defaults, it works. ESRI must be having issues with the addin_assistant.exe.
... View more
07-23-2013
07:32 AM
|
0
|
0
|
797
|
POST
|
James, I understand your logic. Thanks for taking the time to explain your advice. I am struggling to get the Python addin.py to work. I create a new folder, run the addin_assistant.exe, create a toolbar, create a new button, Save the ArcGIS Python Add-in Wizard, edit the python_addin.py, save the python_addin.py, run the makeaddin.py, run the python.esriaddin, install add-in, installation succeedes, customize add-in manager, customize the new add-in, and turn on new toolbar. The button does not work. So I am guessing that my addin script is not working. So, then I go back, edit the script, delete my esriaddin and reun the final few steps. Sometimes the button displays the image selected and other times not. The code is listed below. All I did was change the toolbox location & name and included the script name. Any ideas why the button is not working? import arcpy
import pythonaddins
class UpdatesDates_Name(object):
"""Implementation for UpdatesDates_Name.button (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
pythonaddins.GPToolDialog('E:\User\Python\BCPAO.tbx', 'NameDate.py')
... View more
07-23-2013
06:56 AM
|
0
|
0
|
797
|
POST
|
James, I will try your suggestion and see what happens. Thanks.
... View more
07-23-2013
06:02 AM
|
0
|
0
|
797
|
POST
|
I am attempting to write a Python script that selects a record in the attribute table, zooms to the selected feature, and prompts the user to enter their name. The name field already exists in the attribute table as a string type. How would I get the script to prompt the user to enter their name?Then, have the information they enter stored in the attribute table? I am going to have the users run the script from ArcToolbox. I have tried the python addin to toolbar/button. But, was unable to prompt the user to enter their name or zoom to selected feature without manually selecting the feature. import arcpy #Variables Parcels = arcpy.GetParameterAsText(0) arcpy.AddMessage(Parcels) mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] lyr = arcpy.mapping.ListLayers(mxd, "Parcels", df)[0] arcpy.AddMessage(lyr.name) #Logic try: whereClause = "RENUM = "+Parcels+"" arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause) df.extent = lyr.getSelectedExtent() df.scale = df.scale*1.1 except: print arcpy.GetMessages()
... View more
07-23-2013
05:26 AM
|
0
|
14
|
1806
|
Online Status |
Offline
|
Date Last Visited |
03-21-2024
07:14 AM
|