POST
|
I am still looking at this, but this appears to be a bug in the API since the Path property is null when the tool is being executed. It looks like when the event is triggered only the GPResult property is populated in GPExecuteToolEventArgs , but unfortunately GPResult doesn't contain the tool path or id either. It looks like the Event is called twice, once with IsStarting set to 'true' before the tool runs and once with IsStarting set to 'false' after the tool completes. There are no provisions to 'cancel' the tool, so once the Path property is set to a proper value you will be able to get the tool's name to display a warning in case a 'specific' tool is run. I will report the issue to the GeoPrcoessing dev team. The 3.5 release contains a new GeoProcessing community sample called 'GPToolInspector' that contains the code to retrieve GPTool attributes from a given path. The 3.5 release is available next week. But unfortunately, you'll have to wait for the 'Path' property fix before you can implement a warning.
... View more
2 weeks ago
|
0
|
0
|
136
|
POST
|
I am looking at this issue, but in the meantime i think you can just use the button directly instead of setting the set enable editing API method: // if not editing
if (!Project.Current.IsEditingEnabled)
{
var res = MessageBox.Show("You must enable editing to use editing tools. Would you like to enable editing?",
"Enable Editing?", System.Windows.MessageBoxButton.YesNoCancel);
if (res == System.Windows.MessageBoxResult.No ||
res == System.Windows.MessageBoxResult.Cancel)
{
return;
}
// Project.Current.SetIsEditingEnabledAsync(true);
// use the esri_editing_ToggleEditingBtn instead for .SetIsEditingEnabledAsync
var damlId = "esri_editing_ToggleEditingBtn";
IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper(damlId);
var command = wrapper as ICommand;
if ((command != null) && command.CanExecute(null))
command.Execute(null);
}
... View more
3 weeks ago
|
0
|
0
|
63
|
POST
|
Hi @MinhHoangf Indeed the "Project" button (as @UmaHarano mentioned) is not a standard Framework Plugin (button) like the other tabs on the ArcGIS Pro ribbon. But, since ArcGIS Pro is a WPF application, and you can 'spy' on the WPF visual tree (you can use Visual Studio to do so) to find which control implements the "Project" button. I found that the "Project" control's name is "appButton" and the type of the control is "ActiproSoftware.Windows.Controls.Bars.RibbonApplicationButton". Once ArcGIS Pro is open you can use the code below to update the "Project" button to "New Caption". Note: since we can't access any ActiProSoftware resources the code below is using reflection to make the .Content property update: // change the caption of the 'Application' button in the main window: appButton
string newCaption = "New Caption";
var mainWindow = FrameworkApplication.Current.MainWindow;
if (mainWindow != null)
{
var appButton = mainWindow.FindName("appButton");
if (appButton != null && appButton is FrameworkElement frameworkElement)
{
System.Diagnostics.Trace.WriteLine($@"{appButton.GetType()}");
PropertyInfo propertyInfo = appButton.GetType().GetProperty("Content");
propertyInfo.SetValue(appButton, Convert.ChangeType(newCaption, propertyInfo.PropertyType), null);
}
} In similar fashion you can update the Application's titlebar, but be aware that the titlebar is getting overwritten by project names.
... View more
3 weeks ago
|
1
|
1
|
126
|
POST
|
I attached a small sample add-in project that has a Combo dropdown on the ArcGIS Pro ribbon and two dropdowns on a Dockpane. I am using a dictionary (keys and values) to 'feed' the dropdown content.
... View more
a month ago
|
0
|
0
|
169
|
POST
|
You need to set your json file's properties (in your project file) to 'Build Action' = 'Content' and 'Copy to Output...' = 'Copy if Newer' Then in your Add-in use the following path to read the json file: // read the JSON file from the current assembly's executable folder
string asmblyPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string jsonFilePath = System.IO.Path.Combine(asmblyPath, "MyJsonFile.json");
// read the JSON file
string jsonString = System.IO.File.ReadAllText(jsonFilePath);
... View more
04-17-2025
06:50 AM
|
1
|
0
|
109
|
POST
|
Uma wrote a sample with a tree control that might help you out. arcgis-pro-sdk-community-samples/Editing/EditorInspectorUI at master · Esri/arcgis-pro-sdk-community-samples Did you try to emulate the dropdown selection options as it is shown on the Attribute editing dockpane as shown on the screenshot below? I will try to provide a sample implementation in the upcoming 3.5 release for the community samples.
... View more
04-15-2025
02:20 PM
|
0
|
1
|
87
|
POST
|
I am not sure if this will help you, but it seems to me that you can add code in your tool to deal with the hidden/visible state of your dockpane. for example: protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
// in order to find a dockpane you need to know it's DAML id
var pane = FrameworkApplication.DockPaneManager.Find("your_dockpane_id_here");
// determine visibility
bool visible = pane.IsVisible;
MessageBox.Show($"Dockpane is {(visible ? "visible" : "not visible")}", "Dockpane Visibility");
if (!visible) pane.Activate(true);
return base.OnSketchCompleteAsync(geometry);
}
... View more
04-15-2025
10:37 AM
|
0
|
0
|
91
|
POST
|
@mstranovsky Your code snippet is not applicable in an ArcGIS Pro Add-in. There are two patterns in ArcGIS Pro to deploy a ComboBox: 1) If you are using a Pro Combo box ribbon control you would load the 'Ribbon' Dropdown from a dictionary like this: internal class TestComboBox : ComboBox
{
private bool _isInitialized;
/// <summary>
/// Combo Box constructor
/// </summary>
public TestComboBox()
{
UpdateCombo();
}
// create a dictionary with an entry for each US state, the value should be the capital city of that state
private Dictionary<string, string> _stateCapitals = new Dictionary<string, string>
{
{ "Alabama", "Montgomery" },
{ "Alaska", "Juneau" },
{ "Arizona", "Phoenix" },
{ "Arkansas", "Little Rock" },
{ "California", "Sacramento" },
{ "Colorado", "Denver" },
{ "Connecticut", "Hartford" },
{ "Delaware", "Dover" },
{ "Florida", "Tallahassee" },
{ "Georgia", "Atlanta" }
};
/// <summary>
/// Updates the combo box with all the capitals of the US states
/// </summary>
private void UpdateCombo()
{
if (_isInitialized)
SelectedItem = ItemCollection.FirstOrDefault();
if (!_isInitialized)
{
// Updates the combo box with all the capital names of the US states
foreach (var capital in _stateCapitals.Values)
{
Add(new ComboBoxItem(capital));
}
_isInitialized = true;
}
Enabled = true;
SelectedItem = ItemCollection.FirstOrDefault();
}
/// <summary>
/// The on comboBox selection change event.
/// </summary>
/// <param name="item">The newly selected combo box item</param>
protected override void OnSelectionChange(ComboBoxItem item)
{
if (item == null) return;
if (string.IsNullOrEmpty(item.Text)) return;
}
} 2. If you are using a combobox on a Dockpane, you should use the MVVM pattern to populate the combobox content. In this case, please model your code after @SumitMishra_016 's sample snippet.
... View more
04-15-2025
09:11 AM
|
1
|
0
|
222
|
POST
|
Hi Lingraj, We are checking with our ArcGIS Pro Azure deployment team. They are testing out an Azure Serverless container later this week. We'll let you know what their findings are.
... View more
03-31-2025
05:09 PM
|
0
|
0
|
96
|
POST
|
I attached a sample Button OnClick method that includes all parameters and environment settings to call the 'Topo to Raster' GP Tool. To figure out in what form to pass in the parameter values I usually use the following approach: - I run the GP Tool manually and define all needed parameters - After the GP Tool completes, I click the "Open History" link to open the Geoprocessing History tab - I right click on the GP Tool and select the "Copy Python Command" from the context menu. - I then paste the 'Python Command' syntax into a text editor to see the parameter value formats. - I use the python command's parameter format to fill in the parameters for the ExecuteToolAsync call
... View more
03-26-2025
07:54 AM
|
1
|
0
|
264
|
POST
|
Not sure what ProgressDialogModule.RunCancelableProgress in your snippet does, but if you use a ProgressorSource with a maximum number of steps the progsrc.Value has to match progsrc.Max before the ProgressorDialog goes away. I don't think you need pd.Show() or pd.Hide() as long as you use the Value and Max properties instead. For each completed step (with a total of progsrc.Max steps) increment progsrc.Value, when progsrc.Value is equal to progsrc.Max the progressor dialog closes. You can find a snippet here: CancelableProgressor Class—ArcGIS Pro
... View more
03-25-2025
12:03 PM
|
0
|
0
|
181
|
POST
|
I have experienced this issue myself and traced it back to some random issue with the XAML designer. The errors you are seeing are only 'XAML Designer' errors and usually the errors go away when you close the 'XAML Designer'. The error output is caused by a bug in the 'XAML Designer' and therefore you can 'build and run' the app and bring up your dockpane, even with these 'XAML Designer' errors. Sometimes i was able to fix the issue by closing the solution, deleting the obj and bin folders, reopening the solution and then performing a 'rebuild all'.
... View more
01-06-2025
02:39 PM
|
0
|
1
|
285
|
POST
|
It looks like there's a gap in the ArcGIS Pro API. Normally you would call FrameworkApplication.ContextMenuDataContext to get the 'underlying' (to your right click) tool. The problem is that the returned object is an ArcGIS Pro internal class and hence you can't use that class in your add-in. There is a workaround using reflection that allows you to access the underlying 'tool' context. However, be advised that this solution is outside the Pro API framework and hence subject to change. We will submit a new requirement to the Geoprocessing team for consideration. In order to get the current (right clicked) tool insert this code inside your 'OnClick' button function: protected override void OnClick()
{
try
{
var toolInfo = FrameworkApplication.ContextMenuDataContext; //as ArcGIS.Desktop.GeoProcessing.ToolInfoViewModel;
// internal class ToolInfo:
// public string Name
// public string Description
// public string ToolType
// public bool IsValid
// public string ToolBoxName
// public string FullPath
// public bool IsSystem
// public string toolName
string name = (string)toolInfo.GetType().GetProperty("Name").GetValue(toolInfo, null);
string description = (string)toolInfo.GetType().GetProperty("Description").GetValue(toolInfo, null);
string toolType = (string)toolInfo.GetType().GetProperty("ToolType").GetValue(toolInfo, null);
string toolBoxName = (string)toolInfo.GetType().GetProperty("ToolBoxName").GetValue(toolInfo, null);
string fullPath = (string)toolInfo.GetType().GetProperty("FullPath").GetValue(toolInfo, null);
string toolName = (string)toolInfo.GetType().GetProperty("toolName").GetValue(toolInfo, null);
bool isValid = (bool)toolInfo.GetType().GetProperty("IsValid").GetValue(toolInfo, null);
bool isSystem = (bool)toolInfo.GetType().GetProperty("IsSystem").GetValue(toolInfo, null);
string nl = Environment.NewLine;
MessageBox.Show($@"Type of toolInfo: {toolInfo.GetType().ToString()}{nl}"
+ $@"name: {name}{nl}"
+ $@"description: {description}{nl}"
+ $@"toolType: {toolType}{nl}"
+ $@"toolBoxName: {toolBoxName}{nl}"
+ $@"fullPath: {fullPath}{nl}"
+ $@"toolName: {toolName}{nl}"
+ $@"isValid: {isValid}{nl}"
+ $@"isSystem: {isSystem}{nl}");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} Sample output:
... View more
01-06-2025
02:15 PM
|
0
|
1
|
322
|
POST
|
Are you deleting the field using the UI or are you deleting the field programmatically or are you using a Geoprocessing tool? Can you provide a sample snippet?
... View more
01-03-2025
12:12 PM
|
1
|
1
|
606
|
Title | Kudos | Posted |
---|---|---|
1 | 3 weeks ago | |
1 | 04-17-2025 06:50 AM | |
1 | 04-15-2025 09:11 AM | |
1 | 04-12-2023 11:58 AM | |
1 | 03-26-2025 07:54 AM |
Online Status |
Offline
|
Date Last Visited |
Wednesday
|