|
POST
|
i did put this code at the beginning geodatabase = "C:\gismaps\LusData.mdb" dataset = "ElectricData" feature_class = "PriOHElectricLineSegment"
... View more
12-30-2019
08:17 AM
|
0
|
1
|
1857
|
|
POST
|
Javier, i entered the code that you suggested: When running it i get the following errors:
... View more
12-30-2019
08:16 AM
|
0
|
1
|
1857
|
|
POST
|
thanks everyone for you help. i will see what i need to do to copy the data to a .gdb file. Will get back with you when this is completed.
... View more
12-30-2019
08:02 AM
|
0
|
1
|
1857
|
|
POST
|
Javier, When i do that i get the following: There is no .gdb database.
... View more
12-30-2019
07:53 AM
|
0
|
2
|
1857
|
|
POST
|
Joe, I guess i will have to change the lines to some other command. What i am trying to do here is go to the properties of a layer and create a definition query (i.e. - [FEEDERID] = "2050") and turn off all of the feeders for that layer (Primary OH) that are not numbered 2050. Am i doing this wrong? Is there another way to do this? Thanks
... View more
12-30-2019
07:40 AM
|
0
|
0
|
1857
|
|
POST
|
Javier, I know about ..mxd files but do not know about .gdb files. Is that what you are telling me to put in the Primary_OH_path. Where would the .gdb be located? I do not see one when i search C: drive
... View more
12-30-2019
07:31 AM
|
0
|
1
|
2528
|
|
POST
|
Michael, i can put a print statement but what do you want me to have printed out? I think that the error is due to line 77 but not sure. This is the error that i get
... View more
12-30-2019
06:06 AM
|
0
|
1
|
2528
|
|
POST
|
Dan, All of the instructions look like they are for ArcGIS Pro. I am using ArcGIS Desktop so the screens and input values do not match. Not sure what to do since this is my first attempt at writing a python script. Reading the instructions it looks like i can add all of my inputs to the popup screen. If that is correct where would i put the python script?
... View more
12-30-2019
05:58 AM
|
0
|
1
|
2196
|
|
POST
|
Joe, Thanks for the response. Line 77 is where the error is from tkinter import *
from tkinter import messagebox
import Tkinter, arcpy
myMap = arcpy.mapping.MapDocument("C:/GISMAPS/LUS Map.mxd")
#myMap = arcpy.mapping.MapDocument("CURRENT")
window = Tk()
window.title("Feeders Selection")
window.geometry("680x500")
window.iconbitmap('C:/GISMAPS/lus.ico')
#Define the frame for the feeders to be displayed
frame = Frame(window)
frame.grid(row=1, column=1, padx=15, pady=5)
listNodes = Listbox(frame, width=10, height=10, font=("Helvetica", 10))
listNodes.pack(side="left", fill="y")
#Define the scrollbar in frame window
scrollbar = Scrollbar(frame, orient="vertical")
scrollbar.config(command=listNodes.yview)
scrollbar.pack(side="right", fill="y")
listNodes.config(yscrollcommand=scrollbar.set)
#Add the selection of all feeders
for item in [2050, 2051, 2052,
3050, 3051, 3052, 3550,
4050, 4051, 4052,
5050, 5051, 5052]:
listNodes.insert(END, item)
feeder = listNodes.get(ACTIVE)
#Define all of the checkboxes
prioh_var = IntVar()
priug_var = IntVar()
secoh_var = IntVar()
secug_var = IntVar()
fuse_var = IntVar()
switch_var = IntVar()
sp_var = IntVar()
cap_var = IntVar()
rec_var = IntVar()
pinhook_var = IntVar()
mall_var = IntVar()
peck_var = IntVar()
pri_oh = Checkbutton(window, text = "Primary Overhead", variable = prioh_var,onvalue = 1, offvalue = 0, height=2, width = 20).place(x=2, y=175)
pri_ug = Checkbutton(window, text = "Primary Underground", variable = priug_var,onvalue = 1, offvalue = 0, height=2, width = 20).place(x=12, y=200)
sec_oh = Checkbutton(window, text = "Secondary Overhead", variable = secoh_var,onvalue = 1, offvalue = 0, height=2, width = 20).place(x=8, y=225)
sec_ug = Checkbutton(window, text = "Secondary Underground", variable = secug_var,onvalue = 1, offvalue = 0, height=2, width = 20).place(x=18, y=250)
fuse = Checkbutton(window, text = "Fuse", variable = fuse_var,onvalue = 1, offvalue = 0, height=2, width = 20).place(x=400, y=10)
switch = Checkbutton(window, text = "Switch", variable = switch_var,onvalue = 1, offvalue = 0, height=2, width = 20).place(x=405, y=35)
servicepoint = Checkbutton(window, text = "Service Point", variable = sp_var,onvalue = 1, offvalue = 0, height=2, width = 20).place(x=420, y=88)
capacitor = Checkbutton(window, text = "Capacitor", variable = cap_var,onvalue = 1, offvalue = 0, height=2, width = 20).place(x=412, y=60)
recloser = Checkbutton(window, text = "Recloser", variable = rec_var,onvalue = 1, offvalue = 0, height=2, width = 20).place(x=409, y=87)
pinhook = Checkbutton(window, text = "Pinhook", variable = pinhook_var, state = DISABLED, onvalue = 1, offvalue = 0, height=2, width = 20).place(x=175, y=15)
mall = Checkbutton(window, text = "Mall", variable = mall_var, state = DISABLED, onvalue = 1, offvalue = 0, height=2, width = 20).place(x=165, y=45)
peck = Checkbutton(window, text = "Peck", variable = peck_var, state = DISABLED, onvalue = 1, offvalue = 0, height=2, width = 20).place(x=165, y=75)
#Commit all of the options
def commit():
#my_label = IntVar()
feeder = listNodes.get(ACTIVE)
print feeder
#my_label = Label(window, text=prioh_var.get()).pack()
#check to see which inputs have been selected
if prioh_var.get() == 1:
print("pri_oh = 1")
# show primary overhead feeder where feederid = feeder -ie: [FEEDERID] = "2050"
Expression = "[FEEDERID] = '2050'"
arcpy.SelectLayerByAttribute_management(Primary_OH, "", Expression)
else:
print("pri_oh = 0")
# do not display primary overhead feeder for [FEEDERID] = "2050"
if priug_var.get() == 1:
print("pri_ug = 1")
arcpy.SelectLayerByAttribute_management(Primary_UG, "", "[FEEDERID] = '2050'")
else:
print("pri_ug = 0")
Button(window, text="commit", command=commit).place(x=300, y=350)
#Quit the program
Button(window, text="Quit", command=window.destroy).place(x=400, y=350)
window.mainloop()
... View more
12-27-2019
12:13 PM
|
0
|
2
|
2528
|
|
POST
|
I am trying to run my program and when i get to this part of the program I get the error that global name 'Primary_OH is not defined. Can someone look at my code and tell what i need to do to fix this. Thanks
... View more
12-27-2019
11:14 AM
|
0
|
43
|
8677
|
|
POST
|
Dan, I do not have much experience in creating python scripts and then running them. in fact hardly any at all. I have 2 questions. How would the user start the script without it being attached to a toolbox. Second if i did do the script how do you modify the popup screen to shows the parameters.
... View more
12-27-2019
04:36 AM
|
0
|
1
|
2196
|
|
POST
|
I am trying to create an python script that will allow me to create a map in ArcGIS with the capability to turn certain layers off. For example for electrical feeders i would like to give it 2 criteria (feeder and scale) so that only the feeder i want shows up on the screen. For this to happen i would need to open the layer properties for feeders and under definition i would need to create a definition query such as FeederID = 2050. I would also have to go to general properties and for scale range i would like to set it to "Show layer at all scales". I need to do this for additional items such as fuses, capacitors, reclosers that will also have to meet the 2 criteria. I do not know the commands for ArcGIS well enough to be able to know what the parameters are called so that i can modify them. Hope this makes sense, if not let me know and i will try to explain. Thanks for any suggestions.
... View more
12-26-2019
10:12 AM
|
0
|
0
|
499
|
|
POST
|
Not sure if this is the right forum to ask this question. Let me you if it is not. Right now when i start my python script file i get a popup window that says "This tool has no parameters". I then click ok and my script will then run. Is there a way to disable this popup window so that my program will run right away?
... View more
12-26-2019
05:45 AM
|
0
|
10
|
2776
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-02-2020 10:06 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|