Need to show only the Tool name not the Path name

1027
8
06-26-2017 12:16 AM
JanakiGattu1
New Contributor III

Dear ArcGIS Pro SDK Team,

I have some custom models built using the Model Builder....Using ArcGIS Pro SDK - On Click of a Button, I have written the logic to open the Model for Processing - Which is in turn opening in the Geoprocessing Pane for the Execution.and I dont have any problem in executing the tool. ....But when the tool opens it is showing me the complete Path name where the tool is located - Instead I would like to see only the Tool name...Please find the below screenshot for the same...Help me in getting only the toolname on click of a button not the complete path name in ArcGIS Pro SDK.

0 Kudos
8 Replies
DanPatterson_Retired
MVP Emeritus

do you have that screenshot where it is showing the full path?  You want its 'alias' perhaps

0 Kudos
JanakiGattu1
New Contributor III

Hi Patterson,

Please find the below screenshot as requested...On click of the Button...It is showing me the complete path as below.

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Try this .Net method:

System.IO.Path.GetFileNameWithoutExtension (thePathVariable);
0 Kudos
JanakiGattu1
New Contributor III

Hello Kaiser,

When I used the above method, I am getting only the Tool name and that is perfect...That is exactly what I am looking out for...But the actually functionality of the tool is not coming...Please find the below image for the same. Kindly suggest...

0 Kudos
DanPatterson_Retired
MVP Emeritus

I think you want a line in your code somewhere to actually get the tool which was happening previously, then you want to assign the tools name to the dialog as well.  Would two lines of code accomplish your purpose?

0 Kudos
JanakiGattu1
New Contributor III

Hello Patterson, 

This code is working Perfectly..................But it is displaying the complete path as "F:\PAProject\PAToolbox.tbx\FeatureClassFromXYTable" instead of just toolname "FeatureClassFromXYTable" in the Geoprocessing Pane.

string tool_path = System.IO.Path.Combine(@"F:\PAProject\PAToolbox.tbx", "FeatureClassFromXYTable");
Geoprocessing.OpenToolDialog(tool_path, null);

_________________________________________________________________________________________________

Now When I write the code like this

string tool_path = System.IO.Path.Combine(@"F:\PAProject\PAToolbox.tbx", "FeatureClassFromXYTable");

string tool_path1 =System.IO.Path.GetFileNameWithoutExtension (tool_path);

Geoprocessing.OpenToolDialog(tool_path1, null);

It is showing me just toolname "FeatureClassFromXYTable" in the Geoprocessing Pane. But it is not giving me the required functionality on the click of a button.

0 Kudos
DanPatterson_Retired
MVP Emeritus

according to the help, you use either the alias or the full path. which is in toolbox dot tool notation so what is your alias? (toolbox.tool format)

0 Kudos
JanakiGattu1
New Contributor III

Hello Patterson,

I tried giving the Toolboxname.Toolname as below.

Toolbox Name: PAToolbox

Tool Name: FeatureClassFromXYTable

PAToolbox.FeatureClassFromXYTable

But the System is giving me an error saying that 

0 Kudos