[CONNECT .NET] DgnTool tool name

How do I set the tool name of a primitive tool that ultimately inherits from DgnTool?  The tool name is useful, for example, because it appears in the Undo/Redo edit menu.

Perversely, there's DgnTool.GetToolName, but no method that I see that implements SetToolName.

Parents Reply Children
  • Hi ,

    Sorry I have been unable to respond sooner.  Jan is correct and wrt this post and your other (newer) post, I hope this can help until we have (1) .NET example we can provide (in an SDK update).

    There is a delivered example that shows how to override the GetToolName as Jan recommended; since DgnTool provides no SetToolName method.

    Elements\ManagedToolsExample\SolidUtilClassExamples.cs:26:        protected override string GetToolName () { return "SolidUtil Tool"; }

    As for your other post (populating .NET DgnTool ToolSettings) that will take some additional input from development to hopefully provide a usable code snip.  I will update you on the status/response once received.

    For now and fwiw the code will most likely be based on overriding:

    include\DgnView\DgnTool.h:344:virtual bool _PopulateToolSettings () {return false;}

    HTH,
    Bob



    Answer Verified By: Jon Summers 

  • fwiw the code will most likely be based on overriding _PopulateToolSettings

    I'm sure you're right.  However, a MicroStationAPI tool doesn't really need to use that call.  The native framework knows to load the Tool Settings dialog with an item list identified by the tool's command ID.

    I am not sure if the below question is same as yours?
    MessageCenter.Instance.StatusCommand = "My Cmd";

    No: that fixes the symptom but not the underlying problem.  Consider the VBA CommandState.CommandName read/write property.  It tells the primitive state engine to use that name when referring to the current command.  That's how the command name is entered into the undo/redo buffer queue.

     
    Regards, Jon Summers
    LA Solutions

  • No: that fixes the symptom but not the underlying problem.  Consider the VBA CommandState.CommandName read/write property.  It tells the primitive state engine to use that name when referring to the current command.  That's how the command name is entered into the under buffer queue.

    How about overriding GetToolName() method in DgnTool class?

       class DgnToolDemo : DgnElementSetTool
        {
            protected override string GetToolName()
            {
                return "MyTool";
            }
            public override StatusInt OnElementModify(Element element)
            {
                return StatusInt.Error;
            }
            ...
        }