Skip to content

Menu Integration

Declaring menus in GetInfo

Your plugin adds menu items by returning them in GetInfo.menus. HydroSym builds its UI from this list at startup.

Menus =
[
    new MenuItem
    {
        Id = "acme-search",
        Label = "&Search Acme ERP...",
        Location = "plugin",
        Icon = "search",
        ResultType = "component",
    },
    new MenuItem { Type = "separator", Location = "plugin" },
    new MenuItem
    {
        Id = "acme-checkout",
        Label = "Check &Out",
        Location = "file",
        Icon = "checkout",
        Shortcut = "Ctrl+Shift+O",
        RequiresOpenProject = true,
    },
    new MenuItem
    {
        Id = "acme-checkin",
        Label = "Check &In",
        Location = "file",
        Icon = "checkin",
        RequiresOpenProject = true,
    },
]

Location values

Location Where the item appears
plugin Under the top-level Plugin menu (named after your plugin)
file In the File menu, after the standard items
tools In the Tools menu
toolbar On the main toolbar
context:iborder In the right-click context menu on an i-border

The resultType concept

resultType controls what HydroSym does with the data your OnMenuAction returns.

none — informational actions

The plugin does something (shows a dialog, uploads data) and returns nothing. HydroSym ignores the response body.

Example: "Show PDM Status" — open a dialog showing the current file's version history.

new MenuItem { Id = "show-status", Label = "Show PDM Status", Location = "plugin", ResultType = "none" }

component — insert or configure a component

The plugin shows a search dialog and returns a selected component. HydroSym uses the returned articleCode, description, manufacturer, and properties to insert or update a symbol in the schematic.

Example: "Search Acme ERP..." — a parts browser that lets the engineer find and insert a valve.

new MenuItem { Id = "acme-search", Label = "Search Acme ERP...", Location = "plugin", ResultType = "component" }

OnMenuAction returns:

{
  "articleCode": "HV-301",
  "description": "Directional valve 4/3, 24V DC",
  "manufacturer": "Bosch Rexroth",
  "manufacturerPartNo": "R900052271"
}

openFile — open a project from PDM

The plugin shows a file browser (in the PDM system) and returns a local file path. HydroSym opens that file, optionally checking it out.

Example: "Open from PDM..." — browse the PDM vault and open a schematic.

new MenuItem { Id = "open-from-pdm", Label = "Open from PDM...", Location = "file", ResultType = "openFile" }

OnMenuAction returns:

{
  "filePath": "C:\\Projects\\valve-assembly.hsc",
  "checkOut": true
}

projectId — register a new project

The plugin requests a project identifier from the external system (e.g., create a new ERP project) and returns the ID. HydroSym stores it and uses it for subsequent calls.

Example: "Request Article Number" — create a project record in the ERP and get back its ID.

new MenuItem { Id = "request-id", Label = "Request Article Number...", Location = "plugin", ResultType = "projectId" }

variables — import project metadata

The plugin shows a form or queries the ERP and returns a map of project variables. HydroSym applies these to the project's title block (drawing number, revision, customer name, etc.).

Example: "Import Project Data from ERP" — pull metadata from a work order.

new MenuItem { Id = "import-vars", Label = "Import Project Data...", Location = "plugin", ResultType = "variables" }

Dynamic state via GetMenuItemState

HydroSym calls GetMenuItemState before showing a menu that contains plugin items. Use it to enable, disable, or relabel items based on the current project state.

public override GetMenuItemStateResponse GetMenuItemState(GetMenuItemStateRequest request)
{
    bool hasProject = request.Context.ProjectPath != null;
    bool isCheckedOut = hasProject && _checkedOutFiles.Contains(request.Context.ProjectPath!);

    return new GetMenuItemStateResponse
    {
        States = new Dictionary<string, MenuItemState>
        {
            ["acme-checkout"] = new() { Enabled = hasProject && !isCheckedOut },
            ["acme-checkin"]  = new() { Enabled = isCheckedOut },
        }
    };
}

When is GetMenuItemState called?

Called before HydroSym renders a menu containing plugin items. This is not called for toolbar items until the toolbar is clicked. Keep it fast — it runs on the UI thread.

The auto-generated Settings item

Set hasSettings: true in GetInfo to make HydroSym add a Settings item to your plugin menu automatically. When the user clicks it, HydroSym calls ShowSettings.

HasSettings = true

You do not declare this item in Menus — HydroSym adds it. See guides/settings-dialog.md for implementation.

Icons

Built-in icon names:

Name Icon shown
checkout Lock/open padlock
checkin Lock/closed padlock
search Magnifying glass
upload Upload arrow
download Download arrow
settings Gear
info Information circle
refresh Refresh arrows

For a custom icon, provide a full file path: Icon = "C:\\ProgramData\\HydroSym\\plugins\\acme\\logo.png".

Keyboard shortcuts

Shortcut = "Ctrl+Shift+O"

Standard modifier keys: Ctrl, Shift, Alt. Combine with any letter, digit, or function key. Shortcuts are global while HydroSym is focused.