ERP integration¶
HydroSym: upload the BOM¶
Declare a menu item (plugin, file, or tools) and handle it in OnMenuAction:
Host.GetBom()returns the BOM rows of the active schematic: position, article code, description, and quantity. Hose rows are excluded, andunit,level,parentPosition, andpropertiesare not populated in API v1.- Push the rows to your system.
Host.ShowMessage("Done"), orHost.SetStatusBar(...)for a non-blocking confirmation.
If the upload fails, throw a PluginException; the host shows the message in a dialog. See Call Sequences: Upload BOM.
To attach documents, Host.ExportDrawing and Host.ExportBom write PDFs (format must be "pdf") and return the file path. Other formats raise INVALID_ARGUMENT; a failed export raises EXPORT_FAILED.
HydroSym: title-block fields¶
Advertise getProjectVariables to fill title-block fields from the ERP. HydroSym calls GetProjectVariables with the project path:
- On open, after the file loads and after
BeforeFileOpen(if advertised). The returned keys are written into the schematic's attribute list in memory, after the FMS attribute download, so your values are what the user sees. A later print or BOM action re-syncs header attributes and can overwrite them. - Before CLI PDF export (
createpdf,createsinglepdf,createbomaspdf). Here the header sync runs after your call, so header values can overwrite your keys on the PDF. The.hdfon disk is not rewritten andBeforeFileOpenis not called.
An error from GetProjectVariables is logged; the file still opens and the PDF is still produced. Initialize runs once at process start, so connect there and answer GetProjectVariables from a cache or a quick lookup.
To push values the other way, call Host.SetProjectVariables from a menu action. It merges keys and marks the schematic modified without saving.
HydroMan¶
HydroMan has no Host.GetBom or Host.ExportBom. Use menu actions with Host.GetProjectVariables / Host.SetProjectVariables (the manifold's "Project Variables", also called the UserVarList) and Host.ExportPdf for the production drawing. HydroMan does not call plugin GetProjectVariables; on close, plugin SetProjectVariables (if advertised) arrives with an empty variables map and the project path.
Enable items only when a project is open¶
Set RequiresOpenProject = true on the menu item, or override GetMenuItemState for finer control. Hosts populate PluginContext.ProjectPath only. See Menu Integration.