1

I have developed a custom model using ModelBuilder in ArcGIS, and I would like to use a .NET Base Command to open the geoprocessor parameter window for this tool so the user can enter their parameters, same behavior as if I were double-clicking it in ArcToolbox, as opposed to just executing it programmatically without user interaction. Is this possible?

3
  • possible duplicate of Is it possible to open ModelBuilder SCREEN from .NET base command class? Commented May 3, 2011 at 6:49
  • @Petr This isn't a duplicate. The answer to the question you posted at the link opens up the model in the ModelBuilder editor window. I want to open the tool's geoprocessing tool dialog, the canned one that lets you enter parameters, view help on the right, and set environment at the bottom: Tool Dialog Basics Commented May 11, 2011 at 16:25
  • you're right, sorry, I totally overlooked that. Commented May 11, 2011 at 19:38

2 Answers 2

3

Very similarly to this answer, you can open a tool's dialog with the code below. The code sample opens up the dialog for the "Symmetrical Difference" tool, but you can use your model's name instead of "SymDiff".

 // _app is an IApplication reference (e.g. ArcMap or ArcCatalog app) var arcToolBoxExtension = _app.FindExtensionByName("ESRI ArcToolbox") as IArcToolboxExtension; if (arcToolBoxExtension != null) { var arcToolBox = arcToolBoxExtension.ArcToolbox; var gpTool = arcToolBox.GetToolbyNameString("SymDiff"); if (gpTool != null) arcToolBox.InvokeTool(_app.hWnd, gpTool, null, false); } 
1

Petr has shown the answer, which is the GetToolbyName property on IArcToolbox. You can also refer to the SDK manual which will help you navigate the SDK:

IArcToolbox.GetToolByName

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.