Skip to content

Your First Plugin

This tutorial builds a minimal ERP connector that returns component data for hydraulic valves. By the end you will have a plugin that HydroSym can load and call.

1. Create the project

dotnet new hydrosym-plugin -n AcmeErpPlugin
cd AcmeErpPlugin

Or manually: create a class library, add the NuGet package, and configure the .csproj as described in Installation.

2. Implement GetInfo

GetInfo is called first, before anything else. It tells HydroSym your plugin's name, which methods you support, and what menu items to add.

using PARO.HydroSym.PluginSDK;

public class AcmeErpPlugin : HydroSymPluginBase
{
    public override GetInfoResponse GetInfo()
    {
        return new GetInfoResponse
        {
            Name = "Acme ERP Connector",
            Vendor = "Acme Engineering B.V.",
            Version = "1.0.0",
            ApiVersion = 1,
            Capabilities = ["getComponentParameters"],
            Menus =
            [
                new MenuItem
                {
                    Id = "acme-search",
                    Label = "&Search Acme ERP...",
                    Location = "plugin",
                    Icon = "search",
                    ResultType = "component",
                }
            ],
        };
    }
}

The Capabilities list tells HydroSym which optional methods your plugin handles. Methods not listed here will not be called — HydroSym will treat them as NOT_SUPPORTED automatically.

3. Implement GetComponentParameters

This method is called whenever HydroSym needs to enrich a component. Return article status, price, and any other properties your ERP exposes.

public override GetComponentParametersResponse GetComponentParameters(
    GetComponentParametersRequest request)
{
    // In a real plugin, query your ERP or database here.
    // This example returns hardcoded data for illustration.
    var data = LookupInErp(request.ArticleCode);

    return new GetComponentParametersResponse
    {
        ArticleCode = request.ArticleCode,
        Status = data.Status,           // "released", "draft", "obsolete", "blocked"
        Description = data.Description,
        Price = data.Price,
        Currency = "EUR",
        Manufacturer = data.Manufacturer,
        ManufacturerPartNo = data.ManufacturerPartNo,
        LeadTimeDays = data.LeadTimeDays,
        Stock = data.Stock,
    };
}

private ErpRecord LookupInErp(string articleCode)
{
    // Simulated ERP data for hydraulic valves
    return articleCode switch
    {
        "HV-301" => new ErpRecord("released", "Directional valve 4/3, 24V DC",
                                  1250.00, "Bosch Rexroth", "R900052271", 14, 8),
        "HV-302" => new ErpRecord("released", "Directional valve 4/2, 24V DC",
                                  980.00, "Bosch Rexroth", "R900052272", 14, 12),
        "RV-101" => new ErpRecord("released", "Pressure relief valve, 250 bar",
                                  320.00, "Parker Hannifin", "PVD-250-A", 7, 25),
        _ => throw new PluginException("NOT_FOUND",
                 $"Article code '{articleCode}' not found in ERP.")
    };
}

private record ErpRecord(string Status, string Description, double Price,
                         string Manufacturer, string ManufacturerPartNo,
                         int LeadTimeDays, int Stock);

Throwing PluginException

Throw PluginException with an error code string to return a structured error to HydroSym. The user will see the message in a dialog. See Error Handling.

4. Handle Initialize

Initialize is called once after GetInfo, with context about the HydroSym installation. Use it to read your config file and set up connections.

public override void Initialize(InitializeRequest request)
{
    // request.ConfigPath points to your plugin's .ini file
    // request.WindowsUser is the logged-in Windows username — useful for SSO
    // request.HydroSymVersion lets you handle version-specific behavior
    _connectionString = ReadConnectionString(request.ConfigPath);
}

private string? _connectionString;

5. Build

dotnet publish -c Release

The output in bin/Release/net8.0/win-x64/publish/ contains:

  • AcmeErpPlugin.dll — the native DLL to deploy
  • AcmeErpPlugin.pdb — debug symbols (optional, keep for crash analysis)

6. Deploy

  1. Copy AcmeErpPlugin.dll to C:\ProgramData\HydroSym\plugins\AcmeErpPlugin\.
  2. Edit HydroSym's INI file (usually HydroSym.ini) and add:
[Plugin]
Type=DLL
Path=C:\ProgramData\HydroSym\plugins\AcmeErpPlugin\AcmeErpPlugin.dll

See Building & Deploying for full details.

7. Verify

Start HydroSym. If the plugin loads correctly:

  • The Plugin menu shows your plugin name and the "Search Acme ERP..." item.
  • Opening a schematic with valve HV-301 shows the price and status from your plugin in the component properties panel.

If the plugin does not appear, check the HydroSym log (%APPDATA%\HydroSym\hydrosym.log) for error messages.