|
POST
|
This is the runtimeerror i get anytime i try to start an edit session for my layers warehoused in a geodatabase; >>> edit = arcpy.da.Editor(mxd) Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> RuntimeError: cannot open workspace >>> Please how can i overwhelm this problem of mine? Thanks
... View more
08-30-2012
10:00 PM
|
0
|
7
|
8514
|
|
POST
|
Please start a new thread for this question. It is completely different from the other questions on this thread. Also, I am not an expert on Python custom user interface design, so I am not sure I can help. Please indicate how you created this combobox when you repost. Are you hosting the combobox using a script tool interface, a tkinter interface, or what? Ok ive done that. Thanks
... View more
08-30-2012
01:03 PM
|
0
|
0
|
339
|
|
POST
|
Dear rfairhur24 please i want to be able to select a name from a drop down list of a combobox i created and i use to use the enter tab to set the process and not by just selecting the name. which of the following codes would i use? Thanks def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
... View more
08-30-2012
02:08 AM
|
0
|
0
|
1490
|
|
POST
|
Yeah ive been trying to do so but i think i have issues with my browser--is it by clicking the vote up button?
... View more
08-29-2012
01:12 PM
|
0
|
0
|
1490
|
|
POST
|
A very big thank you to you SIR!!!! Once again you are the main man. You solved yet another problem for me!
... View more
08-28-2012
11:08 PM
|
0
|
0
|
1490
|
|
POST
|
Thanks rfairhur24 you are the man!!! Please can you help me with this problem, im trying to drop my pdf output into a nested folder created from my script and using the searchcursor to get attribute values this is my script; fc = "Parcels"
field = "LGA"
cursor = arcpy.SearchCursor(fc)
for row in cursor:
row.getValue(field)
val = row.getValue(field)
print (row.getValue(field))
field = "District"
cursor = arcpy.SearchCursor(fc)
for row in cursor:
row.getValue(field)
val1 = row.getValue(field)
print (row.getValue(field))
field = "Block_No"
cursor = arcpy.SearchCursor(fc)
for row in cursor:
row.getValue(field)
val2 = row.getValue(field)
print (row.getValue(field))
field = "Plot_No"
cursor = arcpy.SearchCursor(fc)
for row in cursor:
row.getValue(field)
val3 = row.getValue(field)
print (row.getValue(field))
outName = str(val) + "_LGA" + "(" + str(val1) + " _Area" + ")"
outName1 = "Plot_" + str(val3) + "(" "Block_" + str(val2) + ")"
outName2 = "Block_" + str(val2) + "_Plot_" + str(val3) + "_" + str(val1) + "_Area_of_" + str(val) + "_LGA" + ".pdf"
arcpy.CreateFolder_management("C:\\ARA_STATE\\", outName)
arcpy.CreateFolder_management("C:\\ARA_STATE\\"+ outName,outName1)
arcpy.mapping.ExportToPDF(mxd,"C:\ARA_STATE\TDP_For_" + outName1) my final pdf output is not going into something like this arcpy.mapping.ExportToPDF(mxd,"C:\ARA_STATE\TDP_For_" + outName,outName1) What do you think?
... View more
08-28-2012
09:00 PM
|
0
|
0
|
1490
|
|
POST
|
Thanks rfairhur24 you suggestion(s) did the trick for me. Thanks a bunch
... View more
08-28-2012
08:35 PM
|
0
|
0
|
1490
|
|
POST
|
I want to use an if else statement to pass a condition and it's not returning any of the two values what im i doing wrong? fc = "Parcels" field = "GeneratedN" cursor = arcpy.SearchCursor(fc) for row in cursor: row.getValue(field) Val = row.getValue(field) if Val == 1: print "Done" else: print "Not Done" Any suggestions please
... View more
08-28-2012
05:27 PM
|
0
|
11
|
2551
|
|
POST
|
Thank u clthompson for your suggestions, i've been able to create my folders by combining two variables at a time since the create folder function can only take 2 arguments at a time this is my code; >>> outName6 = str(val) + "_LGA" + "(" + str(val1) + " _Area" + ")"
>>> outName1 = "Plot_" + str(val3) + "(" "Block_" + str(val3) + ")"
>>> arcpy.CreateFolder_management("C:\\ARA_STATE\\", outName6)
<Result 'C:\\ARA_STATE\\rin_South_LGA(GRA_Buo_Oho _Area)'>
>>> arcpy.CreateFolder_management("C:\\ARA_STATE\\"+ outName6,outName1)
<Result 'C:\\ARA_STATE\\rin_South_LGA(GRA_Buo_Oho _Area)\\Plot_9(Block_9)'> My next problem is how to drop my pdf in the last folder, i used this code and got this errror message; >>> outName2 = "TDP_FOR_" + "Block_" + str(val2) + "_Plot_" + str(val3) + "_" + str(val1) + "_Area_of_" + str(val) + "_LGA" + ".pdf"
>>> arcpy.mapping.ExportToPDF(mxd,"C:\\ARA_STATE\\" + outName6,outName1,outName2)
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\utils.py", line 181, in fn_
return fn(*args, **kw)
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\mapping.py", line 1133, in ExportToPDF
assert isinstance(data_frame, DataFrame) or (isinstance(data_frame, basestring) and data_frame.lower() == 'page_layout')
AssertionError
>>> arcpy.mapping.ExportToPDF(mxd,"C:\\ARA_STATE\\" + outName6,outName1)
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\utils.py", line 181, in fn_
return fn(*args, **kw)
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\mapping.py", line 1133, in ExportToPDF
assert isinstance(data_frame, DataFrame) or (isinstance(data_frame, basestring) and data_frame.lower() == 'page_layout')
AssertionError What do you think please. Thanks
... View more
08-28-2012
02:38 PM
|
0
|
0
|
1082
|
|
POST
|
I tried to use your last suggestion and this was what i got; >>> arcpy.CreateFolder_management("C:\\ETE_STATE",outName,outName1,outName2,outName3)
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: CreateFolder() takes at most 2 arguments (5 given)
>>> I tried to nest outName1 in outName using the code below and i got another error message; >>> arcpy.CreateFolder_management("C:\\KWARA_STATE\\outName",outName1)
Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 14477, in CreateFolder raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Folder Location: Dataset C:\KWARA_STATE\outName does not exist or is not supported Failed to execute (CreateFolder).
>>> What do you think?
... View more
08-27-2012
08:26 PM
|
0
|
0
|
1082
|
|
POST
|
I am trying to pass the users selection into a definition query in an addin combo box python script. Basically, I have a feature class with a field called "SITE". I build a python list from that field and pass it into the combo box items list. The user will choose a value in the combo box box from that list. I want to further pass the users selection into a definition query. You can see in my script below, I just tried to pass the selection into the definition query, but it crashes the whole combo box and toolbar (i.e. when I reinstall my addin, the tool shows up on my toolbar in big red letters "MISSING"). Obviously I am doing something wrong it I believe it's how I'm passing the selection. As suggestions?
import arcpy
import pythonaddins
sitename = []
for row in arcpy.SearchCursor("Z:\JACOS\Data\GIS\Geodatabases\JACOS_MASTER_2011_PDA_CR.gdb\IF_PDABNDY_R"):
sitename.append(row.SITE)
class ComboBoxClass(object):
"""Implementation for SolsticeFigureUpdater_addin.combobox (ComboBox)"""
def __init__(self):
#self.items = ["item1", "item2"]
self.items = sorted(sitename)
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWWWWWWWWWW'
self.width = 'WWWWWWWW'
def onSelChange(self, selection):
mxd = arcpy.mapping.MapDocument("CURRENT")
for df in arcpy.mapping.ListDataFrames(mxd):
if df.name == "DFMAIN":
dfmain = arcpy.mapping.ListDataFrames(mxd, "DFMAIN")[0]
if df.name == "DFINSET":
dfinset = arcpy.mapping.ListDataFrames(mxd, "DFINSET")[0]
for lyr in arcpy.mapping.ListLayers(mxd, "", dfmain):
if lyr.name == "PDA Boundary":
lyr.definitionQuery = '"SITE" =' selection
arcpy.RefreshActiveView()
arcpy.RefreshTOC()
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
Please mike i am trying to get something very close to what you've posted - i have a field called Name_Allottee and i also want to create a list from this attributes and pass it into my combo box and further drill down with a layer definition query, this is my code can you help me please? Thanks
import arcpy
import pythonaddins
class SelectPlotComboBoxClass(object):
"""Implementation for SelectPlot_addin.combobox (ComboBox)"""
def __init__(self):
#self.items = ["item1", "item2"]
Name_Allottee = []
for row in arcpy.SearchCursor("KWAGIS_Parcels"):
Name.append(row.OBJECTID)
self.items = sorted(Name_Allottee)
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWWWWWWWWWWWWWWWW'
self.width = 'WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW'
def onSelChange(self, selection):
mxd = arcpy.mapping.MapDocument("CURRENT")
for df in arcpy.mapping.ListDataFrames(mxd):
if df.name == "Layers":
dfmain = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
Name_Allottee = []
for row in arcpy.SearchCursor("KWAGIS_Parcels"):
Name_Allottee.append(row.OBJECTID)
for lyr in arcpy.mapping.ListLayers(mxd, "", Layers):
if lyr.name == "KWAGIS_Parcels":
lyr.definitionQuery = '"Name_Allottee"' + "=" + "'" + selection + "'"
arcpy.RefreshActiveView()
arcpy.RefreshTOC()
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass I also got a big red mark when i tried to install the addin.
... View more
08-26-2012
10:40 PM
|
0
|
0
|
1326
|
|
POST
|
I am trying to pass the users selection into a definition query in an addin combo box python script. Basically, I have a feature class with a field called "SITE". I build a python list from that field and pass it into the combo box items list. The user will choose a value in the combo box box from that list. I want to further pass the users selection into a definition query. You can see in my script below, I just tried to pass the selection into the definition query, but it crashes the whole combo box and toolbar (i.e. when I reinstall my addin, the tool shows up on my toolbar in big red letters "MISSING"). Obviously I am doing something wrong it I believe it's how I'm passing the selection. As suggestions?
import arcpy
import pythonaddins
sitename = []
for row in arcpy.SearchCursor("Z:\JACOS\Data\GIS\Geodatabases\JACOS_MASTER_2011_PDA_CR.gdb\IF_PDABNDY_R"):
sitename.append(row.SITE)
class ComboBoxClass(object):
"""Implementation for SolsticeFigureUpdater_addin.combobox (ComboBox)"""
def __init__(self):
#self.items = ["item1", "item2"]
self.items = sorted(sitename)
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWWWWWWWWWW'
self.width = 'WWWWWWWW'
def onSelChange(self, selection):
mxd = arcpy.mapping.MapDocument("CURRENT")
for df in arcpy.mapping.ListDataFrames(mxd):
if df.name == "DFMAIN":
dfmain = arcpy.mapping.ListDataFrames(mxd, "DFMAIN")[0]
if df.name == "DFINSET":
dfinset = arcpy.mapping.ListDataFrames(mxd, "DFINSET")[0]
for lyr in arcpy.mapping.ListLayers(mxd, "", dfmain):
if lyr.name == "PDA Boundary":
lyr.definitionQuery = '"SITE" =' selection
arcpy.RefreshActiveView()
arcpy.RefreshTOC()
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass
Please mike i am trying to get something very close to what you've posted - i have a field called Name_Allottee and i also want to create a list from this attributes and pass it into my combo box and further drill down with a layer definition query, this is my code can you help me please? Thanks import arcpy
import pythonaddins
class SelectPlotComboBoxClass(object):
"""Implementation for SelectPlot_addin.combobox (ComboBox)"""
def __init__(self):
#self.items = ["item1", "item2"]
Name_Allottee = []
for row in arcpy.SearchCursor("KWAGIS_Parcels"):
Name.append(row.OBJECTID)
self.items = sorted(Name_Allottee)
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWWWWWWWWWWWWWWWW'
self.width = 'WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW'
def onSelChange(self, selection):
mxd = arcpy.mapping.MapDocument("CURRENT")
for df in arcpy.mapping.ListDataFrames(mxd):
if df.name == "Layers":
dfmain = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
#if df.name == "DFINSET":
#dfinset = arcpy.mapping.ListDataFrames(mxd, "DFINSET")[0]
Name_Allottee = []
for row in arcpy.SearchCursor("KWAGIS_Parcels"):
Name_Allottee.append(row.OBJECTID)
for lyr in arcpy.mapping.ListLayers(mxd, "", Layers):
if lyr.name == "KWAGIS_Parcels":
lyr.definitionQuery = '"Name_Allottee"' + "=" + "'" + selection + "'"
arcpy.RefreshActiveView()
arcpy.RefreshTOC()
def onEditChange(self, text):
pass
def onFocus(self, focused):
pass
def onEnter(self):
pass
def refresh(self):
pass I also got a big red mark when i tried to install the addin.
... View more
08-26-2012
10:35 PM
|
0
|
0
|
1326
|
|
POST
|
I want to be able to enter a persons name into my combox so as to select it within my active view, this is the code i use which only shows my layers within my data frame; i want to be able to key-in a particular attribute i.e name so as to select the feature with this attribute in my active view. def onFocus(self, focused):
# When the combo box has focus, update the combo box with the list of layer names.
if focused:
self.mxd = arcpy.mapping.MapDocument('current')
layers = arcpy.mapping.ListLayers(self.mxd)
self.items = []
for layer in layers:
self.items.append(layer.name) Your suggestions would be highly appreciated. Thanks
... View more
08-26-2012
09:42 PM
|
0
|
2
|
590
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-19-2015 08:49 AM | |
| 1 | 10-15-2013 04:42 AM | |
| 1 | 09-20-2016 03:45 AM | |
| 2 | 09-25-2016 03:50 PM | |
| 1 | 08-25-2012 09:15 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|