|
POST
|
What version of ArcMap are you debugging against? It sounds as if your project isn't building a new copy of the addin. I'm guessing that you're probably building your addin against 10.1 and the addin was originally built in 10.0.
... View more
09-15-2016
06:29 AM
|
1
|
0
|
1360
|
|
POST
|
As for your first question the answer is yes and I'm not sure if I understand your second question. Are you asking if you can use multiple layers for the driver in data driven pages? If so, the answer would be no. Essentially you'll need to combine the concepts behind the following two samples. Tutorial: Basic web map printing and exporting using arcpy.mapping—Documentation | ArcGIS for Server OR Tutorial: Advanced web map printing/exporting using arcpy.mapping—Documentation | ArcGIS for Server AND Creating a map book with facing pages—Help | ArcGIS for Desktop The actual workflow will vary depending on what you're needing to accomplish. One option is to have map documents on the server with data driven pages already setup. Then you'll have to determine how you want your users to interact with these pages to drive them and generate the needed pdf(s).
... View more
09-15-2016
06:24 AM
|
1
|
2
|
981
|
|
POST
|
# This is essentially the line you'll need
[(f.name, f.aliasName) for f in arcpy.Describe(<PathToTable>).fields]
# This is an example of a way to use it
import arcpy
print("Name,Alias")
for item in [(f.name, f.aliasName) for f in arcpy.Describe(<PathToTable>).fields]:
print(",".join(item))
"""
The above section would output something like
Name,Alias
OBJECTID,OBJECTID
Shape,Shape
AREANAME,AREA NAME
POP2000, POP 2000
"""
... View more
09-15-2016
06:14 AM
|
2
|
0
|
6325
|
|
POST
|
Have you tried installing the VBA compatibility toolkit to see if the tool runs? VBA is no longer supported, but you should be able to continue to consume VBA extensions. If the tool were to fail or throw an exception you'd want to convert it to a supported language (i.e. Java, C++ or .NET). Looking at the sample you posted all of the code is hosted within the Map Document. Have you tried converting this to a COM Component or Addin in a supported language?
... View more
09-15-2016
06:02 AM
|
1
|
0
|
3003
|
|
POST
|
ArcObjects SDK 10.3.x system requirements—Help | ArcGIS for Desktop It should still work on Windows 10. According to the reqs Windows 10 is supported. You'd also need to be using a 32 bit JDK/JRE version 7u75 or higher.
... View more
09-14-2016
06:46 AM
|
1
|
0
|
1062
|
|
POST
|
Is there a reason why you're specifying the Azimuth and Altitude values as Any Value and not Double? The Any Value type would allow you to insert alphanumeric text and I'd assume you'd need to add logic into your code to account for this. For example, Any Value would allow you to provide values like 90° or EAST or 90.0, whereas Double would restrict you to 90.0. You could also use validation logic to verify that your azimuth or altitude values are within the expected ranges. I've included a quick example of the logic below. import arcpy
class ToolValidator(object):
"""Class for validating a tool's parameter values and controlling
the behavior of the tool's dialog."""
def __init__(self):
"""Setup arcpy and the list of tool parameters."""
self.params = arcpy.GetParameterInfo()
def initializeParameters(self):
"""Refine the properties of a tool's parameters. This method is
called when the tool is opened."""
return
def updateParameters(self):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
if self.params[3].value < 0.0 or self.params[3].value > 360.0:
self.params[3].setErrorMessage("Value must be 0 to 360")
else:
self.params[3].clearMessage()
return
... View more
09-14-2016
06:24 AM
|
2
|
1
|
3987
|
|
POST
|
Hi Jamel, I was able to get this to work by fetching the layer from the TOC, casting it to IRasterLayer, grabbing the IRaster from IRasterLayer.Raster, casting it to ESRI.ArcGIS.DataSourcesRaster.IRaster2 and then fetching the fields by iterating through the IRaster2.AttributeTable.Fields enumerator. Below is a small snippet from a combobox example I wrote for another post that I modified for this approach. protected override void OnSelChange(int cookie)
{
if (cookie < 0)
return;
var name = this.items.Where(s => s.Cookie == cookie).FirstOrDefault().Caption;
var layer = LoopThroughLayersOfSpecificUID(ArcMap.Document.FocusMap, "{D02371C7-35F7-11D2-B1F2-00C04F8EDEFF}", name) as ESRI.ArcGIS.Carto.IRasterLayer;
var raster = layer.Raster as ESRI.ArcGIS.DataSourcesRaster.IRaster2;
var fields = new List<string>();
for (int i = 0; i < raster.AttributeTable.Fields.FieldCount; i++)
fields.Add(raster.AttributeTable.Fields.Field[i].Name);
var cbx = ESRI.ArcGIS.Desktop.AddIns.AddIn.FromID<FieldsCombo>(ThisAddIn.IDs.FieldsCombo.ToUID().Value.ToString());
cbx.UpdateItems(fields.ToArray());
base.OnSelChange(cookie);
}
// Loop Through Layers of Specific UID Snippet (ArcObjects .NET 10.4 SDK)
// http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#68527c4d-e69d-42f2-9f9e-81652dd4c329.htm
public string[] LoopThroughLayersOfSpecificUID(ESRI.ArcGIS.Carto.IMap map, System.String layerCLSID)
{
if (map == null || layerCLSID == null)
return null;
List<string> names = new List<string>();
ESRI.ArcGIS.esriSystem.IUID uid = new ESRI.ArcGIS.esriSystem.UIDClass { Value = layerCLSID };
try
{
ESRI.ArcGIS.Carto.IEnumLayer enumLayer = map.get_Layers(((ESRI.ArcGIS.esriSystem.UID)(uid)), true); // Explicit Cast
enumLayer.Reset();
ESRI.ArcGIS.Carto.ILayer layer;
while ((layer = enumLayer.Next()) != null)
names.Add(layer.Name);
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
return names.ToArray();
}
... View more
09-09-2016
07:55 PM
|
0
|
0
|
998
|
|
POST
|
What version of ArcGIS Desktop are you using? What application are you needing to debug in? (e.g. ArcMap, ArcCatalog, ArcScene, ArcGlobe) What version of VS are you using? The exe.config file should start like on of the following: Version 10.0 - 10.3 should start as follows <?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0.30319"/>
<!--<supportedRuntime version="v2.0.50727"/>-->
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ESRI.ArcGIS.ADF.Local" culture="" publicKeyToken="8fc3cc631e44ad86"/>
<bindingRedirect oldVersion="9.3.0.0-10.2.0.0" newVersion="10.3.0.0"/>
</dependentAssembly>
</assemblyBinding> Version 10.4 and higher (Note 10.4 uses .NET 4 as the Minimum Version) should start as follows <?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ESRI.ArcGIS.ADF.Local" culture="" publicKeyToken="8fc3cc631e44ad86"/>
<bindingRedirect oldVersion="9.3.0.0-10.3.0.0" newVersion="10.4.0.0"/>
</dependentAssembly>
</assemblyBinding>
... View more
09-09-2016
05:35 AM
|
1
|
0
|
812
|
|
POST
|
You should probably start with Building map books with ArcGIS. The Create a map book with facing pages page should give you a quick python example to show the bulk of the workflow. For a more specific answer you'll need to be more specific in your question as the workflow will vary significantly depending on how you're wanting to implement it. Typically when I take this approach I already have map documents hosted on my server that already have data driven pages setup and I leverage the GPService to determine what data needs to be added to the maps and what pages to export. You can see an example similar to this on the Advanced web map printing/exporting using arcpy.mapping page.
... View more
09-09-2016
05:11 AM
|
0
|
0
|
463
|
|
POST
|
Did you update your arcmap.exe.config file? Or could you upload it here?
... View more
09-09-2016
03:54 AM
|
0
|
0
|
812
|
|
POST
|
Did you change the ArcMap.exe.config to allow you to debug against .NET 4? The default behavior prior to 10.4 is for it to only allow debugging against 3.5. The url below explains how to do this. It says 10.2 in the title, but it should be true for 10.0 to 10.3.1. .NET 4.0 and 4.5 support for ArcGIS 10.2 Desktop and Engine developers
... View more
09-08-2016
06:43 PM
|
0
|
0
|
812
|
|
POST
|
Have you tried IRaster2 or IRasterBand? IRaster2 http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//001q00000m41000000 IRasterBand http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//001q000005m5000000
... View more
09-08-2016
06:39 PM
|
0
|
2
|
997
|
|
POST
|
Here is an example addin I just wrote up for this scenario. After I've had a chance to clean up the code I'll upload it to my GitHub account and send you the url. I designed my code so that it would add/remove the names of the feature layers to the first combo-box as you add, remove, or reorder layers in the TOC. When you select a name from the first combo-box it populates the names of the fields into the second combo-box. Code for first combo-box using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
namespace ArcMapAddinCBX
{
public class LayerCombo : ESRI.ArcGIS.Desktop.AddIns.ComboBox
{
public LayerCombo()
{
var events = ArcMap.Document.FocusMap as ESRI.ArcGIS.Carto.IActiveViewEvents_Event;
events.ItemAdded += (item) =>
{
System.Diagnostics.Debug.WriteLine("Item Added");
if (!(item is ESRI.ArcGIS.Carto.IFeatureLayer))
return;
this.Add((item as ESRI.ArcGIS.Carto.ILayer).Name);
};
events.ItemDeleted += (item) =>
{
System.Diagnostics.Debug.WriteLine("Item Deleted");
if (!(item is ESRI.ArcGIS.Carto.IFeatureLayer))
return;
var items = new Dictionary<string, Stack<int>>();
foreach (var i in this.items)
{
var key = i.Caption;
if (items.ContainsKey(key))
items[key].Push(i.Cookie);
else
{
var stack = new Stack<int>();
stack.Push(i.Cookie);
items[key] = stack;
}
}
var name = (item as ESRI.ArcGIS.Carto.ILayer).Name;
if (!items.ContainsKey(name))
return;
var cookies = items[name];
foreach (var cookie in cookies)
this.Remove(cookie);
};
events.ItemReordered += (item, toIndex) =>
{
System.Diagnostics.Debug.WriteLine("Item Reordered");
this.Clear();
// "{40A9E885-5533-11D0-98BE-00805F7CED21}" = IFeatureLayer
var names = LoopThroughLayersOfSpecificUID(ArcMap.Document.FocusMap, "{40A9E885-5533-11D0-98BE-00805F7CED21}");
foreach (var name in names)
this.Add(name);
};
}
protected override void OnUpdate()
{
Enabled = ArcMap.Application != null;
}
protected override void OnSelChange(int cookie)
{
if (cookie < 0)
return;
var name = this.items.Where(s => s.Cookie == cookie).FirstOrDefault().Caption;
var layer = LoopThroughLayersOfSpecificUID(ArcMap.Document.FocusMap, "{40A9E885-5533-11D0-98BE-00805F7CED21}", name) as ESRI.ArcGIS.Carto.IFeatureLayer;
var fields = new List<string>();
for (int i = 0; i < layer.FeatureClass.Fields.FieldCount; i++)
fields.Add(layer.FeatureClass.Fields.Field[i].Name);
var cbx = ESRI.ArcGIS.Desktop.AddIns.AddIn.FromID<FieldsCombo>(ThisAddIn.IDs.FieldsCombo.ToUID().Value.ToString());
cbx.UpdateItems(fields.ToArray());
base.OnSelChange(cookie);
}
// Loop Through Layers of Specific UID Snippet (ArcObjects .NET 10.4 SDK)
// http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#68527c4d-e69d-42f2-9f9e-81652dd4c329.htm
public string[] LoopThroughLayersOfSpecificUID(ESRI.ArcGIS.Carto.IMap map, System.String layerCLSID)
{
if (map == null || layerCLSID == null)
return null;
List<string> names = new List<string>();
ESRI.ArcGIS.esriSystem.IUID uid = new ESRI.ArcGIS.esriSystem.UIDClass { Value = layerCLSID };
try
{
ESRI.ArcGIS.Carto.IEnumLayer enumLayer = map.get_Layers(((ESRI.ArcGIS.esriSystem.UID)(uid)), true); // Explicit Cast
enumLayer.Reset();
ESRI.ArcGIS.Carto.ILayer layer;
while ((layer = enumLayer.Next()) != null)
names.Add(layer.Name);
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
return names.ToArray();
}
public ESRI.ArcGIS.Carto.ILayer LoopThroughLayersOfSpecificUID(ESRI.ArcGIS.Carto.IMap map, System.String layerCLSID, System.String layerName)
{
if (map == null || layerCLSID == null || layerName == null)
return null;
ESRI.ArcGIS.esriSystem.IUID uid = new ESRI.ArcGIS.esriSystem.UIDClass { Value = layerCLSID };
try
{
ESRI.ArcGIS.Carto.IEnumLayer enumLayer = map.get_Layers(((ESRI.ArcGIS.esriSystem.UID)(uid)), true); // Explicit Cast
enumLayer.Reset();
ESRI.ArcGIS.Carto.ILayer layer;
while ((layer = enumLayer.Next()) != null)
{
if (layer.Name == layerName)
return layer;
}
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
return null;
}
// Find Command and Execute Snippet (ArcObjects .NET 10.4 SDK)
// http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#c3a1599b-b5ce-4822-9b65-2dc7c9f527e8.htm
public ESRI.ArcGIS.Desktop.AddIns.ComboBox FindCommand(ESRI.ArcGIS.Framework.IApplication application, ESRI.ArcGIS.esriSystem.UID commandUid)
{
ESRI.ArcGIS.Framework.ICommandBars commandBars = application.Document.CommandBars;
ESRI.ArcGIS.Framework.ICommandItem commandItem = commandBars.Find(commandUid, false, false);
if (commandItem != null)
return commandItem as ESRI.ArcGIS.Desktop.AddIns.ComboBox;
return null;
}
}
}
Code for second combo-box using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
namespace ArcMapAddinCBX
{
public class FieldsCombo : ESRI.ArcGIS.Desktop.AddIns.ComboBox
{
public static FieldsCombo hook;
public FieldsCombo()
{
hook = this;
}
public void UpdateItems(string[] items)
{
this.Clear();
foreach (var item in items)
this.Add(item);
}
protected override void OnSelChange(int cookie)
{
if (cookie < 0)
return;
var name = this.items.Where(s => s.Cookie == cookie).FirstOrDefault().Caption;
System.Windows.Forms.MessageBox.Show("You Selected " + name + " from the ComboBox!!");
base.OnSelChange(cookie);
}
}
}
Code for the toolbar <ESRI.Configuration xmlns="http://schemas.esri.com/Desktop/AddIns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>ArcMapAddinCBX</Name>
<AddInID>{d306126e-c332-457b-804e-d944fc88a07b}</AddInID>
<Description></Description>
<Version>1.0</Version>
<Image>Images\ArcMapAddinCBX.png</Image>
<Author>Freddie</Author>
<Company></Company>
<Date>9/8/2016</Date>
<Targets>
<Target name="Desktop" version="10.4" />
</Targets>
<AddIn language="CLR" library="ArcMapAddinCBX.dll" namespace="ArcMapAddinCBX">
<ArcMap>
<Commands>
<ComboBox id="ArcMapAddinCBX_LayerCombo" class="LayerCombo" message="List of Feature Layers in the Map" caption="Layer Combo Box" tip="Select a Feature Layer" category="Add-In Controls" image="Images\LayerCombo.png" sizeString="WWWWWWWWWWWWWWW" itemSizeString="WWWWWWWWWWWWWWW" />
<ComboBox id="ArcMapAddinCBX_FieldsCombo" class="FieldsCombo" message="List of Fields in the Layer." caption="Fields Combo Box" tip="Select a Field Name" category="Add-In Controls" image="Images\FieldsCombo.png" sizeString="WWWWWWWWWWWWWWW" itemSizeString="WWWWWWWWWWWWWWW" />
</Commands>
<Toolbars>
<Toolbar id="ArcMapAddinCBX_CBX_Toolbar" caption="CBX Toolbar" showInitially="true">
<Items>
<ComboBox refID="ArcMapAddinCBX_LayerCombo" />
<ComboBox refID="ArcMapAddinCBX_FieldsCombo" separator="true" />
</Items>
</Toolbar>
</Toolbars>
</ArcMap>
</AddIn>
</ESRI.Configuration> Video Showing How it Works ....coming soon
... View more
09-08-2016
02:59 PM
|
0
|
0
|
1399
|
|
POST
|
Could you upload the source code for your GPFunction? Also, when you say you registered it with the server did you use the 64 bit esriregasm?
... View more
09-07-2016
02:31 PM
|
0
|
1
|
1684
|
|
POST
|
Please see this discussion. https://community.esri.com/message/519399
... View more
09-06-2016
05:58 AM
|
0
|
0
|
489
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-19-2016 04:45 AM | |
| 1 | 09-24-2015 06:45 AM | |
| 1 | 09-15-2015 10:49 AM | |
| 1 | 10-12-2015 03:07 PM | |
| 1 | 11-25-2015 09:10 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|