|
POST
|
That's what I was afraid of. Thanks for the information, Dan.
... View more
11-23-2015
02:29 PM
|
0
|
0
|
595
|
|
POST
|
Is there a way to set feature templates using a python script? I have looked on Google for some time now, and I can't find any way to alter the feature templates using Python. Thanks!
... View more
11-23-2015
01:24 PM
|
0
|
2
|
2639
|
|
POST
|
You are correct! I have been trying to fix the issue with line 13, but it wasn't actually line 13 that was causing the problem. I was missing a closing parentheses just before it. A product of copy/paste when the copied text was actually incorrect. I've been looking at this off an on while doing other things for a couple hours lol...I knew it was going to be super basic. Thanks for taking a look .
... View more
09-23-2015
01:54 PM
|
0
|
1
|
1023
|
|
POST
|
I'm figuring this is a very basic error, but I have been looking at this for a good while now and I can't figure out the syntax error that is kicking back here. Maybe a few other sets of eyes on here will help resolve the issue. I keep getting a syntax error for line 16. It is exactly the same as line 5, but line 5 runs just fine. # Start message
arcpy.AddMessage("Exporting the general features feature class to the " + dbDate + " FGDB...")
# Execute FeatureClassToFeatureClass - General
arcpy.FeatureClassToFeatureClass_conversion(generalFeatures, outFGDB, outGeneral)
# End message
arcpy.AddMessage("General features feature class has been exported to the " + dbDate + " FGDB!")
arcpy.AddMessage("...")
arcpy.AddMessage("...")
# Start message
arcpy.AddMessage("Exporting the node features feature class to the " + dbDate + " FGDB..."
# Execute FeatureClassTo FeatureClass - Node
arcpy.FeatureClassToFeatureClass_conversion(nodeFeatures, outFGDB, outNode)
# End message
arcpy.AddMessage("Node features feature class has been exported to the " + dbDate + " FGDB!")
arcpy.AddMessage("...")
arcpy.AddMessage("...") Thanks in advance!
... View more
09-23-2015
01:47 PM
|
0
|
3
|
2718
|
|
POST
|
That would definitely be ideal...but I don't know how to do that either, unfortunately. I didn't know you could do that. Is the methodology just a lookup of the definition query value and then an error message if it doesn't exist? I'll add a little as well. Our feature classes have an initial query of "NetworkID IS NULL", so that whenever someone opens up our template map, they'll ideally see nothing. They load the new project data, modify the fields in each feature class to match the NetworkID of their respective project, and then apply that definition query to each feature class to show only that NetworkID. The problem is that not everyone remembers to do this. When they get to a certain point where they are to run a script that calculates/runs a lot of fields/tools, they're going to be doing so to a much wider range of data than intended. Since we already have a query applied to show NetworkID IS NULL, I am thinking something like this: class tool_name(object):
"""Implementation for addin_name_addin.button_tool_name (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
for layer in layers: # will define above
if layer.isFeatureLayer:
if layer.name == 'SampleLayer1'
if layer.definitionQuery == """ 'NetworkID = 'SampleProject' """ # I would like to add two options (as shown, and if == none)
pythonaddins.MessageBox('Modify the ' + SampleLayer + ' definition query and retry.', 'Incorrect Definition Query', 0)
elif:
pass
elif: # going through the rest of my feature classes with this level of elif's
pass
elif:
pythonaddins.GPToolDialog(toolPath, 'ToolName') I'm sure there are some issues with this, but it's just a stab in the dark. I'm not sure if the placement of the tool run command is correct, and I'm not sure if my quoting around my definition query is correct either, just to name some that I have concerns with.
... View more
08-17-2015
10:26 AM
|
0
|
0
|
1987
|
|
POST
|
That didn't fix the issue. All of my buttons (not just the one I'm modifying) show up as missing.
... View more
08-17-2015
08:49 AM
|
0
|
0
|
1987
|
|
POST
|
I can already see an error, but I'm not sure if it'll fix the issue. I'm only using one equals sign for mbAnswer = 'Yes'. I'll give that a go.
... View more
08-17-2015
08:45 AM
|
0
|
1
|
1987
|
|
POST
|
I have an add-in created, and it runs the tools as needed. I would like to expand upon those tools to add some checks and balances with questions via the MessageBox function. I can add message boxes just fine, but I'm trying to figure out how to script the *_addin.py file so that it does certain things based on the answer to the message box. I have a simple message box shown below: pythonaddins.MessageBox('Have you applied a definition query to all necessary layers?', 'Query check', 4) This creates the Yes/No message box, and works just fine on its own. The problem now is that I'm not sure how to make Yes run the tool, while No stops the tool. I've tried the following with no luck. pythonaddins.MessageBox('Have you applied a definition query to all necessary layers?', 'Query check', 4)
pythonaddins.GPToolDialog(toolPath, 'ToolNameHere') # toolPath is declared at the top...works without the MB and mbAnswer = pythonaddins.MessageBox('Have you applied a definition query to all necessary layers?', 'Query check', 4)
if mbAnswer = 'Yes':
pythonaddins.GPToolDialog(toolPath, 'ToolNameHere')
else:
pass I can't seem to find anything online regarding how to use the user inputs to determine what to do when clicked. I've found stuff about "Tkinter" and stuff similar, but nothing about the pythonaddins.MessageBox option. Thanks!
... View more
08-17-2015
08:43 AM
|
0
|
4
|
5972
|
|
POST
|
Just to highlight on what you referenced above, we did actually experience an issue with the add-in with the users that were still using 10.2. The add-in was working just fine on my machine, but whenever the others opened their maps, the buttons didn't react when clicked. Simply saving the toolbox to the 10.1/10.2 version did the trick with no other modification needed. Thanks again for all of your help! I'd probably still be lost in documentation somewhere trying to figure it all out .
... View more
08-14-2015
08:06 AM
|
1
|
0
|
1907
|
|
POST
|
Yeah, there were quite a few models that we used in 10.3, that we could no longer see when re backed up to 10.2. Research resulted in me finding out that there is no way to down-save an individual model, but rather you have to down-save the entire toolbox. I'm sure there are little intricacies that go along with that as well. I've been simply exporting the models to python and then trying to clean them up as they're not quite perfect once exported. In reference to creating new buttons manually...I don't even attempt to mess with that lol. Whenever I add new things, I just add an *_1 at the end of my *_addin.py file and then re-save the project with my newly added features. NOTE: I realize that if you save the project, it will automatically add *_1/2/3/4 to the end your existing *_addin.py file, but I actually experienced a complete project folder reset one time when I tried that. I ended up losing the *_addin.py file that had my tool references and everything, so I was a little agitated . How do you roll an add-in back? I don't see how to do so. Is this where the target version in the XML file is used? If so, mine creates it with a target version of 10.1 every time, so I should be good if that is the case.
... View more
08-13-2015
10:29 PM
|
0
|
2
|
1907
|
|
POST
|
Rebecca, One last question regarding this stuff here. You reference using a widget to edit your XML files in your comment above, but I don't think you mentioned what the widget is called. I google search returned a lot of options for XML editors, but I like the way yours looks in the attached image above so I wanted to give that a try and see if I like it. Thanks!
... View more
08-13-2015
11:18 AM
|
0
|
4
|
1907
|
|
POST
|
I believe that I may have found the issue. I was tinkering just a bit more and found that the button was working, and I realized that the one that was working was one that was created inside a project folder that contained no spaces. I created an identical project inside of two separate folders ("test_addin" and "test addin"). The button inside of "test_addin" worked, while the button that was inside of "test addin" did not. Can either of you confirm that the spacing in the project folder does indeed affect the add-in?
... View more
08-12-2015
11:46 AM
|
0
|
2
|
1721
|
|
POST
|
I will circle back and summarize what I find once a solution has been determined. No rush on getting any files to me. I believe I will move on to something else and give this a rest until support reaches out. Maybe the break will do some good .
... View more
08-12-2015
10:53 AM
|
0
|
0
|
1721
|
|
POST
|
The mismatching is due to me creating a whole new project thinking that there may have been an error somewhere down the line that I didn't notice. I created a whole new project so that the *_addin.py file would be default (thinking that the default file would eliminate any syntax errors). I've been using the MessageBox example as shown above just to test, but the button still shows as missing even if I don't add the MessageBox function. I can generate a completely default *_addin.py file, create/install the add-in, and ArcMap still shows a missing button. There can't be any syntax errors if I haven't even typed anything into the file...something has to give here lol. Thank you for your recommendations and assistance as well. I appreciate the efforts.
... View more
08-12-2015
10:27 AM
|
0
|
5
|
1721
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-16-2015 11:55 AM | |
| 1 | 02-04-2015 02:30 PM | |
| 2 | 03-23-2015 11:22 AM | |
| 7 | 03-23-2015 10:09 AM | |
| 3 | 03-23-2016 12:54 PM |
| Online Status |
Offline
|
| Date Last Visited |
03-06-2025
09:05 PM
|