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?


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);

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:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.