|
POST
|
Hi Laura Once you have your custom python tool in a toolbox in a Pro project, you can add it to a button on the Pro ribbon. So when you click the button, your tool will execute. I am assuming this is what you want to do. The following details how to exactly accomplish this. 1. Using the Pro SDK, you will create an Add-in project in Visual Studio. This is a .NET project that allows you to extend the Pro UI with new buttons, etc. 2. You will add a Button item template to this add-in project using the Pro SDK. 3. The button class file created by the Pro SDK will have an OnClick method stubbed out for you. This is where you would add code to access/run a specific GP tool - in your case your custom python tool in the toolbox in Pro. 4. To run a GP tool using the .NET Pro API, you can use ExecuteToolAsync method or the Geoprocessing.OpenToolDialog method. Code snippets for all this is available in this message trail above. A useful link on how to get started with the Pro SDK is ProGuide: Build your first add in Thanks Uma
... View more
04-17-2019
03:14 PM
|
0
|
0
|
3661
|
|
POST
|
Hi Laura In Pro, you can Insert a new Toolbox into your project and then add your script tool (test1.py) to that toolbox. This help topic walks you through this: Use a custom geoprocessing tool Also, this help topic has some information on how to structure the parameters in the script tool: https://pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/basics/create-a-python-script-tool.htm Once you have your custom tool included in Pro, you can run it manually using the UI, or using the Pro API. Thanks Uma
... View more
04-17-2019
01:08 PM
|
0
|
2
|
3661
|
|
POST
|
Hi You can add an entire feature service or just one layer to your map using the CreateLayer method on the LayerFactory. To add just one layer, you use the layer ID. Like this: string url = @"http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0"; //FeatureLayer off a map service or feature service
Uri uri = new Uri(url);
await QueuedTask.Run(() => LayerFactory.Instance.CreateLayer(uri, MapView.Active.Map)); Here is a code snippet for this: Create and add a layer to the active map To access data via databases - you can use connection properties. Here are some code snippets for this: Opening an Enterprise Geodatabase using connection properties Opening an Enterprise Geodatabase using sde file path Getting Database Connection Properties from a Connection File Thanks Uma
... View more
04-17-2019
10:46 AM
|
0
|
2
|
2314
|
|
POST
|
Hi To run a specific GP Tool using the Pro API, you can call the ExecuteToolAsync method. There are some samples available that will walk you through this: Sample that uses a GP Tool. Some more code snippets that runs GP Tools If you need to open a specific GP Tool dialog using code, you can do something like this: string input_data = @"C:\data\data.gdb\Population";
string out_pdf = @"C:\temp\Reports.pdf";
string field_name = "INCOME";
// use defaults for other parameters - no need to pass any value
var arguments = Geoprocessing.MakeValueArray(input_data, out_pdf, field_name);
string toolpath = @"C:\data\WorkflowTools.tbx\MakeHistogram";
Geoprocessing.OpenToolDialog(toolpath, args); You can use the Pro SDK Item templates and create a button item in a Pro add-in. The OnClick event stubbed out for you via the template is where you would add code to access/run a specific GP tool. This button can then be displayed directly on the Pro ribbon or you can add them to a "toolbar" on the Pro ribbon. Thanks Uma
... View more
04-17-2019
10:39 AM
|
0
|
4
|
3661
|
|
POST
|
Yes. If you check out line 150 in the config.daml in this sample, it shows how to add toolbars to the ribbon.
... View more
04-17-2019
10:18 AM
|
0
|
0
|
3661
|
|
POST
|
Hi Laura Yes, Tools can be added to a Toolbar on the Pro ribbon. You can define which tools/buttons you want on the toolbar using this piece of code in your config.daml: <toolbars>
<toolbar id="TestToolbar">
<group>
<button refID="ArcProToolbar_ButtonOnToolbar" />
<tool refID="ArcProToolbar_MyMapTool"></tool>
<tool refID="ArcProToolbar_MyConstructionTool1"></tool>
</group>
</toolbar>
</toolbars> And then you add the toolbar using its refID to the group and the tab like this: <tabs>
<tab id="ArcProToolbar_Tab1" caption="New Tab">
<group refID="ArcProToolbar_Group1" />
</tab>
</tabs>
<groups>
<!-- comment this out if you have no controls on the Addin tab to avoid
an empty group-->
<group id="ArcProToolbar_Group1" caption="Group 1" appearsOnAddInTab="false">
<!-- host controls within groups -->
<toolbar refID="TestToolbar" />
</group>
</groups> The RibbonControls sample has a toolbar in it. Thanks Uma
... View more
04-17-2019
09:58 AM
|
1
|
8
|
3661
|
|
POST
|
In your Visual Studio Community Edition installation, can you please check if you have installed the .NET Desktop development workload? This is required to display the templates.
... View more
04-12-2019
08:19 AM
|
1
|
1
|
1435
|
|
POST
|
Here is the registry key to set in order to define Configurations well known folders for all users on the machine: Configuration Folders
... View more
04-12-2019
08:16 AM
|
0
|
0
|
837
|
|
POST
|
Hi You can modify any layer's label expression using this snippet: Modify label expression using Arcade var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(f => f.ShapeType == esriGeometryType.esriGeometryPolygon);
if (lyr == null) return;
QueuedTask.Run(() => {
//Get the layer's definition
//community sample Data\Admin\AdminSample.aprx
var lyrDefn = lyr.GetDefinition() as CIMFeatureLayer;
if (lyrDefn == null) return;
//Get the label classes - we need the first one
var listLabelClasses = lyrDefn.LabelClasses.ToList();
var theLabelClass = listLabelClasses.FirstOrDefault();
//set the label class Expression to use the Arcade expression
theLabelClass.Expression = "return $feature.STATE_NAME + TextFormatting.NewLine + $feature.POP2000;";
//Set the label definition back to the layer.
lyr.SetDefinition(lyrDefn);
}); Thanks Uma
... View more
04-11-2019
01:02 PM
|
2
|
1
|
2486
|
|
POST
|
Hi Stuart ArcGIS Pro 2.4 SDK will support Visual Studio 2019. Thanks Uma
... View more
04-10-2019
01:19 PM
|
1
|
2
|
1196
|
|
POST
|
Hi, Answers are posted here: https://community.esri.com/thread/231883-start-up-page-for-an-arcgis-pro-add-in
... View more
04-10-2019
08:37 AM
|
0
|
0
|
630
|
|
POST
|
Hi Jaowon, You should create a Pro Configuration. This is similar to an add-in but it allows you to customize Pro's start-up experience. Using a Configuration you will be able to show a custom start page when the application launches. In this custom start page, you can display a control to list your layers. When the layers are selected, you can initialize a Pro session - a New Map in your case - with the layers selected. Here are some links that can get you started with this: 1. ProGuide: Configurations 2. ProConcepts: Configurations 3. Configuration Samples: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/ConfigWithMap https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/ConfigWithStartWizard Thanks Uma
... View more
04-09-2019
09:38 AM
|
1
|
1
|
1423
|
|
POST
|
Hi, You can implement States and Conditions to enable/disable controls on the ribbon. ProGuide: Code Your Own States and Conditions Sample: Working with DAML This sample has a section that creates a custom state and condition. Thanks Uma
... View more
04-09-2019
08:24 AM
|
1
|
0
|
1368
|
|
POST
|
Hi Max On further testing, I found that this code snippet works for 2.3. CIMPictureGraphic seems to work for 2D Maps at this point. A little bit of work is needed for 3D support still. It will be available in a future release. Note: This specific overload of the AddOverlay method needs to be used. SourceURL property is not being used currently. Used PictureURL instead. The only supported format to provide the URL currently are these: // e.g. local file URL (note the 3 slashes): // file:///<path> // file:///c:/images/symbol.png // e.g. network file URL: // file://<host>/<path> // file://server/share/symbol.png // get the current mapview and point
var mapView = MapView.Active;
if (mapView == null)
return;
var pictureGraphic = new CIMPictureGraphic();
pictureGraphic.PictureURL = @"file:///E:/Stuff/MyImage.png";
pictureGraphic.Box = envelope;
_graphic = mapView.AddOverlay(pictureGraphic); Thanks Uma
... View more
04-02-2019
04:58 PM
|
0
|
1
|
1261
|
|
POST
|
Hi Are you referring to the Zoom to button at the bottom of the Pop up - screenshot below: The only way to customize the Zoom to on the Pop-up is to provide your own pop-up. Here is a sample that shows you how to implement this: Custom Pop-up. Note: You cannot replace Pro's pop-up. Thanks Uma
... View more
04-01-2019
10:06 AM
|
1
|
0
|
594
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-18-2025 03:09 PM | |
| 1 | 11-04-2025 08:25 AM | |
| 1 | 09-23-2025 09:31 AM | |
| 1 | 11-20-2024 10:50 AM | |
| 1 | 04-28-2025 03:06 PM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|