POST
|
Alan, We have done what you are trying to do. That is accessing native C++ code from an ArcGIS Pro Add-In. There are number of things to understand to get it to work correctly. I will enumerate them here as I know them. 1. Understand that your C# Add-In project and it's .Net dependencies will be compressed into a <NameOfYourAddIn>.esriAddInX file that you will find in your <My Documents Folder>\\ArcGIS\AddIns\ArcGISPro\{GUID_OF_YOUR_ADDIN} folder. 2. At runtime ArcGIS Pro checks this folder structure to see if there are AddIn's to be loaded. It then takes the contents within the Install folder of that archive and extracts them to your <UsersDirectory>\AppData\Local\ESRI\ArcGISPro\AssemblyCache\{GUID_OF_YOUR_ADDIN} 3. Unfortunately, as stated earlier, this does not include your Native C++ dependencies 4. ArcGIS Pro 2.2 would only create the AssemblyCache entry if it did not exist. We took advantage of this and created an installer that placed all of the required code in the appropriate AssemblyCache subfolder. But, again, the trigger or ArcGIS Pro to even consider that an add in availabe is the *.esriAddInX file discussed above. So we created that entry as well. With those in place, our code worked great all the time. 5. Unfortunately we were taking advantage of an undocumentated "feature". This is always risky practice as ArcGIS Pro 2.4 wipes the AssemblyCache clean evertime it runs and extracts the contents of the *.esriAddInX archive's install subfolder everytime. So for ArcGIS Pro 2.4 we needed a runtime solution. Fortunately every AddIn has Module class that is instantiated when the AddIn is loaded. So our workaround was to install our Native C++ dependencies to a subdirectory in the user's "My Documents" folder and then at runtime our Module class copies all of those dependencies to the appropriate AssemblyCache subfolder. The important thing here is to be sure there are no calls that would need to load your Native C++ dependencies before all the dependencies have been copied. Good luck!
... View more
09-23-2019
01:14 PM
|
1
|
1
|
3990
|
POST
|
So I'm thinking my question was probably too broad. At this point, I'm thinking that we should move to an enterprise geodatabase sooner rather than later. With that in mind, I know that ESRI can't recommend any particular one but does anyone out there have anything to say about Oracle vs SQL Server vs PostgresSQL/PostGIS? I'm leaning towards the latter since it's open source but if either Oracle or SQL Server is far superior then we could argue for additional funds to go that route. Any thoughts? Recommendations? White papers? Thanks!
... View more
09-11-2019
10:06 AM
|
0
|
0
|
321
|
POST
|
Can someone point me to a good resource for best practices regarding Geographic Database configuration management. I have a project that I want to be able to have a "master copy" of input datasets and their results and then allow a user to modify the datasets and generate new results with losing the original input datasets and their respective results. Hope that makes sense. Thank you.
... View more
09-04-2019
03:50 AM
|
0
|
1
|
384
|
POST
|
1. They are boilerplate projects so both projects have Module1 (not renamed) 2. They in separate Visual Studio Projects but the same solution. 3. I did not use the ProjectSettingsViewModel. Just to save settings to your project you don't need that IMHO (unless you really need the user to see a property page). As you can see all I did was override the the OnRead... and OnWrite...methods. In one of our AddIns we have quite a few state variables and user settings are that are persisted this way, again, without using ProjectSettingsViewModel. Hope that helps.
... View more
07-16-2019
08:39 AM
|
0
|
0
|
799
|
POST
|
Evan, I'm going to need to do this before the end of the summer too so took a quick break and decided to create two boilerplate C# ArcGIS Pro SDK AddIn's. In both instances, I overrode both the OnWriteSettingsAsync and the OnReadSettingsAsync as shown below. The only other thing I did (took make sure the modules would load since I didn't write any other code) was I edited each config.daml to turn on the autoload="true" for the <insertModule> tag. To get ArcGIS Pro to fire the OnWriteSettingsAsync, I just adjusted the zoom level of the map and responded "Yes" to whether I wanted to save settings and both AddIn's OnWriteSettingsAsync fired and save the "Name" string that I specified. When I reloaded the same project file, both OnReadSettingsAsync were called one after the other. I confirmed this via break-point in each method. I'm using ArcGIS Pro 2.4 and the corresponding SDK and Visual Studio 2019. Hope that helps. protected override Task OnWriteSettingsAsync(ModuleSettingsWriter settings)
{
System.Diagnostics.Debug.WriteLine("OnWriteSettings TestWriteSettingsNumber2.....");
settings.Add("Name", "TestWriteSettingsNumber2");
return base.OnWriteSettingsAsync(settings);
}
protected override Task OnReadSettingsAsync(ModuleSettingsReader settings)
{
string l_progress = settings.Get("Name") as string;
return base.OnReadSettingsAsync(settings);
}
... View more
07-16-2019
07:33 AM
|
1
|
2
|
799
|
POST
|
Thank you. I will give it a try this week and let you know if I have any questions or problems.
... View more
07-15-2019
12:46 PM
|
0
|
0
|
276
|
POST
|
I will have the need in the near future to render a path through 3d space and would like to represent the aircraft flying this path in the correct position and orientation. What's the best way to do this using the ArcGIS Pro SDK? Thanks!
... View more
06-17-2019
03:23 PM
|
0
|
2
|
362
|
POST
|
ArcGIS Pro Experts... 🙂 My team and I have recently completed a basic integration of a number of backend specialized computational methods that are accessible through the Ribbon Buttons create by our ArcGIS Pro AddIn. The steps to perform the analysis using the buttons has a specific order and explicit dependencies. For novice users and expert users alike we were considering adding a Wizard or Leveraging Workflow Tasks. Can someone share what the advantages/disadvantages of one of the other is? Thank you. Best Regards, Dan
... View more
03-21-2019
01:13 PM
|
0
|
0
|
241
|
POST
|
This is what you're looking for.... I think... Create points from a table—ArcGIS Pro | ArcGIS Desktop
... View more
12-05-2018
08:31 AM
|
0
|
1
|
500
|
POST
|
Jaewon, What format is your table of data in? If it's CSV there are any number of csv readers out there that you can find with plenty of examples...Google is your friend..:-)... But you might be asking whether or not there is anything built into ArcGIS SDK that will do that... That I am not sure about. Could you add a CSV to the Catalog in Pro? Hmmm...
... View more
12-05-2018
07:28 AM
|
1
|
0
|
500
|
POST
|
Would be glad to update the code formatting if someone could tell me how to do that withing the body of the question...:-)
... View more
12-05-2018
06:40 AM
|
0
|
1
|
206
|
POST
|
I have a couple of routines that generate anywhere from 30-40 polygons with approximate 800+ points each. I call each routine from two different ArcGIS Pro SDK Button Add-In Controls as part of my custom ArcGIS Pro Add-In. After each routine I take the Polygons that were created add them to the map using the code below (sorry couldn't figure out how to format the coding correctly). It was working for both buttons consistently until yesterday when only one button would work. Meaning that I would click one button this routine would run and I'd see my polygons on the map and then I'd push the second button and the second time the routine would get stuck on the bool l_created = l_createFeatures.Execute(); line of code (i.e. Execute() never returned). After trying several different things I decided that maybe the problem was my database so I shutdown ArcGIS and I deleted the DefaultGeodatabase folder for my project. I reran and it started working normally again. Any thoughts on what happened and how I can prevent this from happening again? See anything wrong with the code below? Is there a problem with polygons with that many points? My add-in is in beta release now but would like to know the root of the problem before final release. Thank you. // First obtain the FeatureLayer based on the name of the layer (l_featureClassName)
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
var l_mapLayers = l_mapView.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>();
foreach (FeatureLayer l_featureClassLayer in l_mapLayers)
{
if (l_featureClassLayer.Name == l_featureClassName)
{
l_featureLayer = l_featureClassLayer;
break;
}
}
});
//Second Set the Opacity for the Polygons so I can overlapping Polygons
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
//Create polygon outline.
CIMStroke l_outline = SymbolFactory.Instance.ConstructStroke(
ColorFactory.Instance.BlackRGB,
1.0,
SimpleLineStyle.Solid);
//Create polygon fill with outline.
CIMPolygonSymbol l_fillWithOutline = SymbolFactory.Instance.ConstructPolygonSymbol(
ColorFactory.Instance.CreateRGBColor(0.0, 0.0, 0.0, 0.0),
SimpleFillStyle.Solid,
l_outline);
//Get layer's current renderer.
CIMSimpleRenderer l_renderer = l_featureLayer.GetRenderer() as CIMSimpleRenderer;
//Update current renderer's symbol.
l_renderer.Symbol = l_fillWithOutline.MakeSymbolReference();
//Update layer's renderer.
l_featureLayer.SetRenderer(l_renderer);
});
//Third Perform EditOperation to add polygons to layer
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
var l_createFeatures = new EditOperation();
l_createFeatures.CancelMessage = "Operation Cancelled";
l_createFeatures.ErrorMessage = "Error creating polygon";
l_createFeatures.ShowProgressor = true;
// l_arcGISPolygons is List<Polygon>
for (int i = 0; i < l_arcGISResults.Count; i++)
{
l_createFeatures.Name = $"Create Result Polygon #{i}";
l_createFeatures.ProgressMessage = $"Adding Result Polygon #{i} to the Map.....";
//Create a feature with a polygon.
l_createFeatures.Create(l_featureLayer, l_arcGISResults[i]);
}
//Execute the operation. Must be called within QueuedTask.Run.
bool l_created = l_createFeatures.Execute();
});
// Finally Save Edits to Layer
await Project.Current.SaveEditsAsync();
... View more
12-05-2018
06:38 AM
|
0
|
2
|
290
|
POST
|
Part 1: My team and I were struggling a bit early with creating a FeatureLayer and adding it to the active map using ArcGIS Pro SDK 2.2. We finally figured it out and were wondering about the Geoprocessing.ExecuteToolAsync which we used. Is there a list somewhere that shows all the ESRI developed tool paths? We used "CreateFeatureclass_management" for our purposes and the "cheat" I found was just to go to ArcGIS Pro interface's Python window and import arcpy and then type arcpy. to get the intellisense to help. But if there was a web page that was available that would be better. Part 2: It appears that we are calling Python code from C# (in our case). We have the .Net SDK I would think there should be a way to do what "CreateFeatureclass_management" does in C#? If not why not? Thank you.
... View more
10-30-2018
03:10 PM
|
0
|
1
|
357
|
POST
|
Ugggh!! Found the problem! We changed the name of the Module1 class but we never updated the Config.daml. The first line in the Config.daml after the <modules> opening tag is an <insertModule> tag with a className attributed that needs to match the class name. I'm curious as to why it only crashed when the DockPane was added though. I'm thinking that MapTool's and Button Tool's don't interact with the Module within ArcGIS API itself but something in DockPane's base class or otherwise does and this is is why the problem only showed up when we added the Dockpane. Obviously this was a problem we created but I'm curious as to the underlying why and why we wouldn't get a more meaningful message. Seems like an exception handler is needed within the API to handle this condition and pass back a meaningful message similar to when synchronous calls are made outside of a QueuedTask.
... View more
10-20-2018
05:23 AM
|
0
|
0
|
467
|
POST
|
Just added DockPane to my custom ArcGIS Pro Add-In. My Add-In currently has 2 MapTool Buttons and a regular Button tool already defined and I'm now adding a Dockpane tool. I'm getting an AggregateException everytime I show the Dockpane but I have not added any code beyond the boiler plate code added by the SDK template (i.e. Add/New Item/Dock Panel). It does NOT crash when the Dockpane is first shown but if I wait about 30 seconds or less this exception is thrown: System.AggregateException was unhandled Message: An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll Additional information: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. Attached are the threads that are running when this crash happens...
... View more
10-19-2018
12:31 PM
|
0
|
2
|
597
|
Title | Kudos | Posted |
---|---|---|
1 | 09-23-2019 01:14 PM | |
1 | 07-16-2019 07:33 AM | |
1 | 12-05-2018 07:28 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|