Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
    
@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 –  Gady May 11 '11 at 16:25
    
you're right, sorry, I totally overlooked that. –  Petr Krebs May 11 '11 at 19:38

2 Answers 2

up vote 2 down vote accepted

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);
        }
share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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