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:
<button refID="ArcProToolbar_ButtonOnToolbar" />
And then you add the toolbar using its refID to the group and the tab like this:
<tab id="ArcProToolbar_Tab1" caption="New Tab">
<group refID="ArcProToolbar_Group1" />
<!-- 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" />
The RibbonControls sample has a toolbar in it.
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:
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";
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.
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.
I know how to do all that but I would really like it run from a toolbar. Is this possible with that script? could you go over more of the steps for the ribbon one to work? or does it have to have the toolbox and be in catalog?
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