|
POST
|
Hi, Default geoprocessing ExecuteToolAsync method flag adds data to map and refreshes project items (GPExecuteToolFlags.AddOutputsToMap | GPExecuteToolFlags.RefreshProjectItems). Use flag GPExecuteToolFlags.None. More info here: https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9375.html
... View more
02-12-2023
05:51 AM
|
1
|
1
|
1621
|
|
POST
|
Hi, You need to get ICommand from ICommandItem and then tocast it to your control class. For example my control class is : public partial class myComboboxControl
: UserControl, ICommand, IToolControl, ImyComboboxControl
{
// class code here
} Then to get my control I use code below: ICommand comm = pCommItem.Command;
if (comm is myComboboxControl)
{
myComboboxControl myCombobox = comm as myComboboxControl;
// call myCombobox public method
}
... View more
02-01-2023
10:32 PM
|
0
|
0
|
1652
|
|
POST
|
Hi, Have you tried GetTemplates method from MappingExtensions? More info here. There is ArcGIS Pro SDK community sample for choosing template from list: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Editing/TransferAttributes
... View more
01-30-2023
04:00 AM
|
0
|
1
|
1839
|
|
POST
|
Hi, Code for toolbox content below: var gpItems = CoreModule.CurrentProject.Items.OfType<GeoprocessingProjectItem>();
// go through all the available toolboxes
foreach (var gpItem in gpItems)
{
var itemsInsideToolBox = gpItem.GetItems();
// then for each toolbox list the tools inside
foreach (var toolItem in itemsInsideToolBox)
{
string newTool = String.Join(";", new string[] { toolItem.Path, toolItem.Name });
// do something with the newTool
// for example, add to a list to track or use them later
}
} If your toolbox is not added to project try to create it using ItemFactory: var item = ItemFactory.Instance.Create(toolboxPath); And add it to project. More info here: GeoprocessingProjectItem Class—ArcGIS Pro Create Method (ItemFactory)—ArcGIS Pro
... View more
01-29-2023
07:06 AM
|
1
|
1
|
1563
|
|
POST
|
Hi, There is no need to install ArcGIS Pro addin if you add addin path to registry. Installation puts your addin to Documents\ArcGIS\AddIns\ArcGISPro catalog. This is default folder for addins. It could be matter in which registry part you add the folder: local machine or current user.
... View more
01-27-2023
07:14 AM
|
0
|
0
|
2016
|
|
POST
|
I have solutions migrated from 2.x to 3.0, but I haven't issues like yours. Migration was painful to me too. I have made all steps of migration documentation and repaired code changes. Try to cleanup project. Check references of your project and etc.
... View more
01-25-2023
07:36 AM
|
0
|
0
|
1881
|
|
POST
|
I have created new tool (with FooTool nam) in existing Esri community sample project (3.0), then copy/pasted your code inside existing FooTool class
... View more
01-25-2023
07:09 AM
|
0
|
2
|
1886
|
|
POST
|
Microsoft Visual Studio Enterprise 2022 (64-bit) - Current Version 17.4.3 I think problem is in project or solution configuration.
... View more
01-25-2023
06:56 AM
|
0
|
4
|
1889
|
|
POST
|
Hi, I have copied your code and it works fine on ArcGIS Pro 3.0.3 and ArcGIS Pro SDK for .NET 3.0.0.36057
... View more
01-25-2023
06:14 AM
|
0
|
6
|
1901
|
|
POST
|
You can create feature layer from feature class, but not from table. Table doesn't have geometry. You need to create featureclass in memory or project gdb, create features in it using your table data and then you can create feature layer from LayerFactory
... View more
01-25-2023
06:02 AM
|
0
|
0
|
6394
|
|
POST
|
Hi, You could use the code from Esri community samples: private async Task<bool> ExecuteDeleteFieldTool(BasicFeatureLayer theLayer, string fieldName)
{
try
{
return await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
var inTable = theLayer.Name;
var table = theLayer.GetTable();
var dataStore = table.GetDatastore();
var workspaceNameDef = dataStore.GetConnectionString();
var workspaceName = workspaceNameDef.Split('=')[1];
var fullSpec = System.IO.Path.Combine(workspaceName, inTable);
System.Diagnostics.Debug.WriteLine($@"Delete {fieldName} from {fullSpec}");
var parameters = Geoprocessing.MakeValueArray(fullSpec, fieldName);
var cts = new CancellationTokenSource();
var results = Geoprocessing.ExecuteToolAsync("management.DeleteField", parameters, null, cts.Token,
(eventName, o) =>
{
System.Diagnostics.Debug.WriteLine($@"GP event: {eventName}");
if (eventName == "OnMessage")
{
System.Diagnostics.Debug.WriteLine($@"Msg: {o}");
}
});
return true;
});
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
return false;
}
} Write specific messages from your python code and you get content of message in event "OnMessage". Parse message content for specific type. For example, for progressor message could start with prefix "Progressor:". All message text could look like this "Progressor: 1". It will mean that progressor value must be equal to 1. arcpy.AddMessage("Progressor: 1") P.s. There is "OnProgressMessage" and "OnProgressPos" messages too which you can use directly. Try to investigate in arcpy library. Solved: How to get return value from python tool - Esri Community SetProgressor—ArcGIS Pro | Documentation
... View more
01-25-2023
04:17 AM
|
1
|
0
|
953
|
|
POST
|
Hi, To make a point feature layer from table you need to execute xy table to point geoprocessing tool. Code here: var sr = MapView.Active.Map.SpatialReference;
var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);
var cts = new CancellationTokenSource();
//Make the GP Tool arg array
var args = Geoprocessing.MakeValueArray(input_table, outputFC, XField, YField, "", sr);
//Execute
_ = await Geoprocessing.ExecuteToolAsync("XYTableToPoint_management", args, environments, cts.Token,
(eventName, o) =>
{
System.Diagnostics.Debug.WriteLine($@"GP event: {eventName}");
}, GPExecuteToolFlags.None); //No action is taken, so the new Feature class doesn't get added to the map Your question theme is very similar to this: https://community.esri.com/t5/arcgis-pro-sdk-questions/adding-feature-layers-using-plugins-for-different/m-p/1245203#M9228
... View more
01-25-2023
04:03 AM
|
1
|
2
|
6408
|
|
POST
|
Hi, Have you succeeded with updating Web Mapping App itemId?
... View more
01-24-2023
03:44 AM
|
0
|
0
|
1383
|
|
POST
|
As @JMalik said, JSON file store place depends on your workflow. You can store in project settings if your user wants to modify JSON file place or content. You can store in add-in config file. This way for advanced user. You can store JSON file as add-in's resource if you don't want to let change something and etc. My application consists of some add-ins. One of them is responsible for project/application settings, license and etc. I am calling it as "main module". All other add-ins get application sensible information from "main module". "Main module" Json settings property would look like that: public string JsonSetting
{
get {
// your implementation
return GetJsonString();
}
}
... View more
01-23-2023
11:52 PM
|
0
|
0
|
5680
|
|
POST
|
I use my own configuration interface and implement that interface to each add-in Module Class. For your case it would be something like that: public interface IMyConfiguration
{
string JsonSetting { get; set; }
} Main add-in sets JsonSetting property from your prefered source. Others read that setting from main add-in like this: public string JsonSetting
{
get
{
// get the configuration module:
var configModule = FrameworkApplication.FindModule("MainModule"); // Main module ID from daml
if (configModule is IMyConfiguration)
{
IMyConfiguration configInterface = configModule as IMyConfiguration;
return configInterface.JsonSetting;
}
return null;
}
catch (Exception ex)
{
return null;
}
}
}
... View more
01-23-2023
06:21 AM
|
0
|
1
|
5701
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 2 | 04-24-2026 08:33 AM | |
| 1 | 03-23-2026 11:44 AM | |
| 1 | 05-22-2024 11:48 PM |
| Online Status |
Offline
|
| Date Last Visited |
Wednesday
|