|
POST
|
Good day everyone, I have created a simple python addin which works in ArcMap. The addin has 4 buttons, two that execute script tools, two that execute models. The toolbox that the models & script tools are located in is stored in a network folder. The buttons use pythonaddins.GPToolDialog() to execute a model/script tool stored on the network. This simple diagram shows the layout: My question is: 1. When a button is clicked on the addin on the local PC, where does the model or script execute? 2. Are there any risks if multiple PC's are accessing the toolbox on the network drive at the same time? Thanks, Chris
... View more
02-15-2017
01:47 PM
|
0
|
4
|
2909
|
|
POST
|
Well, that might be a work around. Thanks for the idea! Sent from my iPhone
... View more
02-14-2017
07:37 AM
|
0
|
0
|
1152
|
|
POST
|
Hello all, I'm wondering if there is a way to have more than one "My Toolboxes". Ideally I'd like to have a "My Toolboxes_D" and a "My Toolboxes_P". One pointing to a dev location, the other to a prod location. So far to move between referencing dev and prod locations I've been editing the value of: in the Registry Editor using the above location for my prod and the default My Toolboxes location for my dev. Just seems easier if I can have 2 My Toolboxes rather than continually going into the registry to edit that value. Thanks, Chris
... View more
02-14-2017
05:21 AM
|
0
|
3
|
1558
|
|
POST
|
So, while I was able to get this working and save the annotation to a file geodatabase. The "Convert Labels to Annotation" form in the manual arcMap process to give you the ability to save the annotation in the existing mxd file. I was not able to find a way to accomplish that with arcpy. Is that not possible? Thanks all!
... View more
01-13-2017
11:17 AM
|
0
|
1
|
4094
|
|
POST
|
Here's the solution I have to date. It is in the context of a model at this point. I plan to at some point move it into a single script tool. Script for CreatePolygonE (found the base code for this on geonet from Jake Skinner - Thanks Jake): import arcpy
locno = arcpy.GetParameterAsText(0)
year = locno[3:7]
arcpy.AddMessage('locno: ' + locno)
workspace = "O:/plan/luam/1p2007/" + year + "/" + locno + "/data_for_item.gdb" #|data"
arcpy.env.workspace = workspace
mxd = "O:/plan/luam/1p2007/" + year + "/" + locno + "/" + locno + "-existing_proposed.mxd"
mxd = arcpy.mapping.MapDocument(mxd)
dataframe = arcpy.mapping.ListDataFrames(mxd, "*")[0]
frameExtent = dataframe.extent
XMAX = frameExtent.XMax
XMIN = frameExtent.XMin
YMAX = frameExtent.YMax
YMIN = frameExtent.YMin
pnt1 = arcpy.Point(XMIN, YMIN)
pnt2 = arcpy.Point(XMIN, YMAX)
pnt3 = arcpy.Point(XMAX, YMAX)
pnt4 = arcpy.Point(XMAX, YMIN)
array = arcpy.Array()
array.add(pnt1)
array.add(pnt2)
array.add(pnt3)
array.add(pnt4)
array.add(pnt1)
polygon = arcpy.Polygon(array)
arcpy.CopyFeatures_management(polygon, "Polygon_Extent")
result = True
arcpy.SetParameterAsText(1, result) Script for CreateAnnotation: import arcpy
locno = arcpy.GetParameterAsText(0)
year = locno[3:7]
arcpy.AddMessage('locno: ' + locno)
mxd = "O:/plan/luam/1p2007/" + year + "/" + locno + "/" + locno + "-existing_proposed.mxd"
Polygon_Extent = "O:/plan/luam/1p2007/" + year + "/" + locno + "/data_for_item.gdb/Polygon_Extent"
outGdb = "O:/plan/luam/1p2007/" + year + "/" + locno + "/data_for_item.gdb"
GroupAnno = "GroupAnno"
# Process: Tiled Labels To Annotation
arcpy.TiledLabelsToAnnotation_cartography(mxd, "Layers", Polygon_Extent, outGdb,
GroupAnno, "Anno", "4000", "", "", "", "", "STANDARD", "GENERATE_UNPLACED_ANNOTATION")
result = True
arcpy.SetParameterAsText(1, result)
... View more
01-09-2017
11:17 AM
|
1
|
0
|
4094
|
|
POST
|
Thanks for the reminder James. Yes, I’m just ironing out a few bugs and will then post the solution.
... View more
01-05-2017
07:31 AM
|
0
|
1
|
4094
|
|
POST
|
Excellent. Thanks Curtis. Yes, was definitely thinking to do my development local then move to the network. Cheers! Sent from my iPhone
... View more
12-23-2016
01:31 PM
|
0
|
0
|
1586
|
|
POST
|
Hello everyone, I found the following link which describes how to make a registry edit to change the default location of "My Toolboxes". By default it is located in C\Users.... http://support.esri.com/technical-article%5C000011321 I have written a number of models and scripts and am wondering if it is better to have them sitting on a network drive and make a registry change for each user who needs them rather than copying the Toolboxes in the each persons C:\users... path. Seems easier to just have to update the network toolbox once if tools are updated than to have to go around to every persons PC to make any updates. Are there any downsides to doing this change? I'm wondering possibly performance may be slower? Could there be any conflicts if more than one person tries using them at the same time??? Thanks for reading, Chris
... View more
12-16-2016
11:10 AM
|
1
|
2
|
3353
|
|
POST
|
Hello everyone, Wondering if there is a way to complete the following using arcpy. Any insights appreciated. My searches so far haven't turned much up. Thanks, Chris
... View more
12-13-2016
06:31 AM
|
0
|
8
|
5276
|
|
POST
|
Thanks Micah and Rebecca. I will explore the information both of you have provided to me. Very much appreciated! Chris
... View more
12-06-2016
03:28 PM
|
0
|
0
|
2367
|
|
POST
|
Hi Rebecca, The input would be gathered at the start of the program. I have not started working on this yet, just trying to figure out if it's doable. What I'm looking for is to be able to have something like this appear after selecting the menuitem off of the toolbar where the user would enter the address into the one field and select a LuCode from the dropdown: Then click "Ok" and the code would run. My hunch is that it's not doable, just hope I'm wrong on that. Thanks
... View more
12-06-2016
01:37 PM
|
0
|
2
|
2367
|
|
POST
|
Hello everyone, I have been searching and searching and have not been able to find a definitive answer. Is there any way to have a user provide input to a python add-in. I have a process that runs via a model which uses 2 model parameters (one via a textbox, one via a combobox). I am trying to see if the same process can be done a python add-in. Thanks, Chris
... View more
12-06-2016
11:46 AM
|
0
|
5
|
3814
|
|
POST
|
I figured it out. I needed to add arcpy.RefreshTOC(). duh. I'll give the correct answer to Rebecca as she got me onto the path of getting this working. Funny that I had previously looked at that link just didn't see the item about the feature datasets. Thanks also for your suggestions Mitch. Here is the finished working script: import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.name == 'roads':
lyr.replaceDataSource(r"X:\GIS\geo_databases\labelling_features.gdb","FILEGDB_WORKSPACE","roads")
if lyr.name == 'railways':
lyr.replaceDataSource('X:/GIS/geo_databases/labelling_features.gdb','FILEGDB_WORKSPACE','railways')
elif lyr.name == 'rivers':
lyr.replaceDataSource('X:/GIS/geo_databases/labelling_features.gdb','FILEGDB_WORKSPACE','rivers')
elif lyr.name == 'lakes':
lyr.replaceDataSource('X:/GIS/geo_databases/labelling_features.gdb','FILEGDB_WORKSPACE','lakes')
elif lyr.name == 'bridge_polygons':
lyr.replaceDataSource('X:/GIS/geo_databases/planning_data.gdb','FILEGDB_WORKSPACE','bridge_polygons')
arcpy.RefreshTOC()
mxd.save
del mxd
Result = True
arcpy.SetParameterAsText(0,Result)
... View more
11-29-2016
06:57 AM
|
1
|
0
|
2075
|
|
POST
|
In the link provided by Rebecca: http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/updatingandfixingdatasources.htm#ESRI_SECTION1_1ACA0FBD09924B56A43CE5A5DBD18D7D I read: Do not include the names of geodatabase feature datasets in the workspace path. Feature datasets are part of the workspace. If a feature class, for example, is moved from being a stand-alone feature class into a geodatabase feature dataset, a map document will still open without the layer being broken. So I removed the reference to the feature datasets in each workspace "|data". The script works now, but it doesn't do anything. lol I'll have to recheck the parameters I'm using.
... View more
11-29-2016
06:40 AM
|
1
|
1
|
2075
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-10-2020 03:34 PM | |
| 1 | 02-23-2021 11:53 AM | |
| 1 | 02-16-2021 09:15 AM | |
| 1 | 12-10-2020 07:46 AM | |
| 1 | 01-18-2019 09:54 AM |
| Online Status |
Offline
|
| Date Last Visited |
04-22-2021
04:31 PM
|