Thanks Neil, I will give it a try and report.
This code uses the tool's ProgId:pUID.value = "esriCore.SketchTool"It has been my experience that using the ProgId requires the command or tool to be on a toolbar or menu somewhere.If you use the actual class GUID, then the command or tool does not have to be on a toolbar or menu:pUID.value = "{" & yourClass.ClassId & "}"The code above is .NET and assumes the command/tool class is in your code project. You can also just use the hard-coded GUID (you'll have to do this for built-in tools and tools whose code is not in your project).
Thanks, I will give it a try, all online examples show this technique. But would it work even if the command has not been added to the CommandBar - because the example tries to find the command by ICommandBars.Find().
Not totally sure you can do this, but if it's registered already then you should be able to execute it via it's GUID just like any other registered command. For example, this code would initiate the Sketch Tool: 'set the current tool to be the editor Sketch tool Dim pCommandItem As ESRI.ArcGIS.Framework.ICommandItem Dim pUID As New ESRI.ArcGIS.esriSystem.UID pUID.value = "esriCore.SketchTool" pCommandItem = m_pApp.Document.CommandBars.Find(pUID) m_pApp.CurrentTool = pCommandItem m_pEditEvents = pEditor
I have developed a command that implements ICommand and ITool. This command is registered in the ESRI MX Commands category. How can I execute this command programmatically without having to add it to a toolbar or a commandbar?
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.