POST
|
Hi Dan, In ArcGIS 9, you can put your vba code and button in the Normal template, which makes it global. But that is no longer supported starting at ArcGIS 10. So if you're using 10, you need to create an Add-In. You indicate you're using the Express edition of Visual Studio, so you will have to use VS 2008, since that's what the SDK installer supports. You should be able to simply reinstall the SDK to get the ArcGIS templates into VS.
... View more
04-10-2012
01:30 PM
|
0
|
0
|
18
|
POST
|
Hello Robert, The easist option, imo, is VBA to Add-In. You can code the Add-In in VB.NET, C#, or JAVA. A year ago I put together a tutorial on converting a simple VBA 9.3 ArcMap utility that included a button that launches a form and performs a simple move features operation. It converts the VBA to a C# Add-In, but the process for VB.NET is very similar and with less changes needed to go from VBA to VB.NET. VBA to Add-In Conversion Tutorial
... View more
01-19-2012
03:22 PM
|
0
|
0
|
3
|
POST
|
Hi Charles, Your line of code: element.Geometry = balloonParms.AnchorPoint; sets the position of the balloon text (lower-left corner). To set the leader line, you need to create another Point for the anchor of the leader line (offset from the text element of course) and assign it to IBalloonCallout.AnchorPoint. If you are already setting that in your GetTextBalloon() method, then you just need to use a point offset from it for IElement.Geometry. IOW, the leader won't show unless there is an offset between the two.
... View more
01-03-2012
11:31 AM
|
0
|
0
|
2
|
POST
|
I see the same behavior in the generated code and the subsequent error. However, try editing the line in the Config.Designer.cs file from: internal static string TestNamespace.cmdTest { to: internal static string TestNamespaceCmdTest { (just remove the dot, or change the name to something else appropriate) Then do a rebuild and it should work. Note: in the sample Addin that I tested this with, upon the first rebuild after I edited the static property name, the name was reset to the one with dots and the build failed again. After editing it again it seemed to stick for subsequent builds.
... View more
12-21-2011
07:49 AM
|
0
|
0
|
11
|
POST
|
Thanks, Neil! That makes it work. And thanks for the explanation. Here is the corrected line that will fix the prior code: ICommandBar contextMenu = cmdBars.Find(contextMenuUID, false, false) as ICommandBar;
... View more
12-16-2011
09:02 AM
|
0
|
0
|
17
|
POST
|
I threw something together, but it isn't working. Here is some C# test code for an Add-In extenstion attempting to add an item to the Feature Layer Context Menu: protected override void OnStartup() { WireEvents(); } private void WireEvents() { ArcMap.Events.OpenDocument += new ESRI.ArcGIS.ArcMapUI.IDocumentEvents_OpenDocumentEventHandler(Events_OpenDocument); ArcMap.Events.NewDocument += new ESRI.ArcGIS.ArcMapUI.IDocumentEvents_NewDocumentEventHandler(Events_NewDocument); } void Events_OpenDocument() { System.Diagnostics.Debug.WriteLine("**** Events_OpenDocument ****"); LoadContextMenu(); } void Events_NewDocument() { System.Diagnostics.Debug.WriteLine("**** Events_NewDocument ****"); LoadContextMenu(); } private void LoadContextMenu() { ICommandBars cmdBars = ArcMap.Application.Document.CommandBars; UID contextMenuUID = new UIDClass(); contextMenuUID.Value = "{BF643199-9062-11D2-AE71-080009EC732A}"; //esriArcMapUI.FeatureLayerContextMenu ICommandBar contextMenu = cmdBars.Find(contextMenuUID, false, true) as ICommandBar; if (contextMenu != null) { // Get the command item you want to add UID commandUID = new UIDClass(); commandUID.Value = "Test_TestParaTextButton"; // Add-in button ID //Check if it is already present on the context menu. ICommandItem myCmdItem = contextMenu.Find(commandUID, false); if (myCmdItem == null) { Object pos = contextMenu.Count - 1; myCmdItem = contextMenu.Add(commandUID, ref pos); //myCmdItem.Group = true; myCmdItem.Refresh(); } } else { System.Diagnostics.Debug.WriteLine("**** contextMenu is null ****"); } } The contextMenu object is null on both calls to the method, so I suspect the GUID is either wrong or no longer supported.
... View more
12-16-2011
08:10 AM
|
0
|
0
|
17
|
POST
|
I was also thinking, "The only trick is finding the guid of the context menu." I found the following: {BF643199-9062-11D2-AE71-080009EC732A} esriArcMapUI.FeatureLayerContextMenu in the 9.0 documentation for Names and IDs . I couldn't find it in the similar 10.0 documentation . Maybe I'm looking in the wrong place?
... View more
12-15-2011
03:11 PM
|
0
|
0
|
17
|
POST
|
I haven't implemented that before, but I suspect you will need to use ICommandBar, since its documentation mentions context menus. I also think you're on the right track using an extension. You might want to have a look at this thread where we did something similar to add a menu to ArcMap's main menu bar: Modify-(add)-to-MAIN-Toolbar-with-Addinx-files Be sure to post back if you get anywhere -- or not.
... View more
12-15-2011
12:56 PM
|
0
|
0
|
17
|
POST
|
According to another thread, the caption property bug will be fixed in 10.0 SP4 and 10.1: Change Caption of Base Command
... View more
11-22-2011
09:10 AM
|
0
|
0
|
11
|
POST
|
I suspect it is because you are using the IFeatureDataConverter2 . I just did a quick test with IExportOperation instead, in an Add-In, and it does export joined fields. Here's some quick and dirty code that I tested it with: public void PerformTest5() { // Get the selection in TOC. object item = ArcMap.Document.SelectedItem; // Make sure it is a feature layer if (item is IFeatureLayer) { IFeatureLayer featureLayer = item as IFeatureLayer; IDisplayTable displayTable = featureLayer as IDisplayTable; ISelectionSet selectionSet = displayTable.DisplaySelectionSet; IDataset dataset = displayTable.DisplayTable as IDataset; IDatasetName datasetName = dataset.FullName as IDatasetName; IWorkspaceFactory outShapeWSF = new ShapefileWorkspaceFactoryClass(); IDataset outShapeWS = outShapeWSF.OpenFromFile("C:\\GIS", 0) as IDataset; IWorkspaceName outShapeWSName = outShapeWS.FullName as IWorkspaceName; IDatasetName outShapeName = new FeatureClassNameClass(); outShapeName.Name = "Export_test1"; outShapeName.WorkspaceName = outShapeWSName; IExportOperation exportOperation = new ExportOperationClass(); exportOperation.ExportFeatureClass(datasetName, null, selectionSet, null, outShapeName as IFeatureClassName, 0); } else { MessageBox.Show("Please select a feature layer."); } }
... View more
11-18-2011
01:22 PM
|
1
|
1
|
22
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|