# PcdHmfProbeMerger - User Guide ## What this tool does PcdHmfProbeMerger updates probe and tip/angle names inside selected PC-DMIS routine files (`.PRG`). It compares: - **PC-DMIS names** found in your routines - **HexMF names** loaded from the HexMF server Then it replaces routine names with the mapped target names. --- ## Before you start 1. Start **PC-DMIS** first. 2. Start **PcdHmfProbeMerger** with the **same Windows user permissions** as PC-DMIS. 3. Make sure your routine files (`.PRG`) are available. 4. (Optional) Set a backup folder in the app before processing. > ⚠ For better performance, it is recommended that you manually back up the measurement routines before modifying them with this tool. > If HexMF is not reachable, the app can still work with normalized names, but HexMF-based matching is limited. --- ## Quick workflow 1. **Connect to PC-DMIS** - The app connects automatically on startup. - The default **PC-DMIS probe folder** is read from PC-DMIS and pre-filled in the UI. 2. **Load routines** - Drag & drop `.PRG` files or folders into the file list. - You can also drag & drop a folder directly onto **PC-DMIS probe folder** or **Routine backup folder** fields. 3. **Generate mapping (one-time or when probe data changes)** - Click **Generate mapping**. - The app loads HexMF probes and visible PC-DMIS probes from the selected folder using: - `ParserFactory.GetVisibleProbes(string.Empty, PcdProbeFolder, PcdSearchOrder)` - Probe/tip mappings are created and saved to JSON. 4. **Load mapping** - Click **Load mapping** to load mapping data from JSON. - On application startup, loading from JSON is also performed automatically when a config is present. 5. **Review/edit mappings** - Check probe mappings first. - Check tip mappings below each probe. - Edit target names in the **PC-DMIS (new)** fields if needed. 6. **Run replacement** - Start processing. - The app uses the JSON mapping as source of truth, then opens each routine offline and applies replacements. 7. **Check result** - Each routine shows a status (for example `Completed`, `NotReplaced`, or `MappingIssue`). --- ## Mapping config (JSON) The mapping is persisted in: `C:\Users\Public\Documents\Hexagon\PcdHmfProbeMerger\pcd-hmf-mapping.json` Saved data includes: - `PcdProbeFolder` - `PcdSearchOrder` - `BackupRootPath` - Probe mappings (`PcdProbeName`, `PcdDisplayProbeName`, `HexProbeName`) - Tip-slot mappings (`PcdTipSlot`, `HexTipSlot`) Notes: - The probe folder can still be changed manually via the browse button at any time. - Regenerating mapping updates JSON based on current PC-DMIS/HexMF data. --- ## Routine statuses - **Completed**: at least one probe or tip was replaced. - **NotReplaced**: no applicable replacement was found for that routine. - **MappingIssue**: routine contains probes/tips with unresolved mapping and is skipped during processing. - **Processing**: routine is currently being handled. --- ## Logging and troubleshooting If something was not replaced, check the log files in: `C:\Users\Public\Documents\Hexagon\PcdHmfProbeMerger` Look for entries such as: - `LOADPROBE detected ...` - `Probe replaced ...` - `Tip replaced ...` - `No mapping found for LOADPROBE ...` - `No tip mapping found ...` These lines show exactly why a replacement did or did not happen. ## Quick Troubleshooting - **Status stays `NotReplaced`** - Run **Analyze routines** again. - Confirm the routine actually contains `LOADPROBE` and active tip commands. - Check log lines for `No mapping found for LOADPROBE ...`. - **Status is `MappingIssue`** - Review probe/tip mappings and resolve unmatched entries. - Run **Analyze routines** again to refresh issue detection. - Start processing again; routines with `MappingIssue` are skipped until mapping is resolved. - **No tip names are replaced** - Verify a probe replacement was detected first (`LOADPROBE detected ...`). - Check `No tip mapping found ...` entries in the log. - **HexMF data seems missing** - Make sure network/server access to HexMF is available. - Restart the app and run **Analyze routines** again. - **PC-DMIS connection warning is shown** - Start PC-DMIS before this tool. - Run both applications with the same Windows privileges. - **Routine was changed unexpectedly** - Set a **Backup folder** before processing. - Restore the original-named `.PRG` file from that backup folder if needed. --- ## Tips for best results - Use routine files that contain valid `LOADPROBE` / tip commands. - Keep probe names consistent between your PC-DMIS data and expected HexMF naming. - Re-run **Analyze routines** after changing the routine selection. - Set a backup folder when processing production routines.