Visio image rebuilder

From FOURTEEN1416/academic-agent-toolkit · View interactive version

Visio image rebuilder is an AI agent skill from the GitHub repository FOURTEEN1416/academic-agent-toolkit. 从参考图或既有 .vsdx 重建/改造可编辑的 Visio 原生图形(非贴图),导出 vsdx、PNG、SVG、PDF、PPTX。

How to use this skill

Skill file

Visio Image Rebuilder

Core Rule

Recreate the reference as editable Visio content. Do not satisfy a rebuild request by inserting the whole reference image into the page. Embedding the reference image is only allowed as a temporary locked tracing layer if it is removed or hidden before delivery and the final .vsdx remains native shapes, text, connectors, and groups.

Treat .vsdx as the source of truth. Export PNG, SVG, PDF, or PPTX only when the user asks for those formats or when a visual preview is needed for verification. For fast Chinese technical-bid flowchart work, the default deliverable is the saved .vsdx only.

Windows PowerShell And CJK Text

When generating PowerShell automation scripts on Windows, keep the script body ASCII-only whenever practical. Raw Chinese string literals in .ps1 files can be mis-decoded by Windows PowerShell and may surface as parse errors or apparent Visio COM hangs.

For Chinese labels, build strings from escaped Unicode instead of embedding raw CJK text:

function UE([string]$text) {
    return [regex]::Replace($text, '\\u([0-9A-Fa-f]{4})', {
        param($m)
        return [string]([char][Convert]::ToInt32($m.Groups[1].Value, 16))
    })
}

$label = UE '\u8fdb\u5ea6\u7ba1\u63a7'

If a rebuild fails early, inspect the PowerShell parser output before assuming Visio COM is stuck.

Chinese Technical-Bid Flowchart Mode

Use this mode for repeated Chinese engineering, tender, bid, QA/QC, supervision, procurement, schedule, or change-management flowcharts, especially when the user says "continue drawing this one" or provides several screenshots in sequence.

Workflow

  1. Inspect inputs.
  1. Decode the reference image.
  1. Prefer Visio automation for native edits.
  1. Use package XML edits only for narrow, deterministic changes.
  1. Export requested formats from the verified Visio source.
  1. Verify without overtrusting a single signal.

Implementation Pattern

For full rebuilds, generate a script that:

Start from scripts/visio_rebuild_scaffold.ps1 when building a full reconstruction script. Copy it into the workspace and customize the Draw-ReferenceFigure function rather than editing the skill copy.

For style transfer, generate a script that:

For export-only requests, run:

powershell -ExecutionPolicy Bypass -File scripts\visio_page_tools.ps1 `
  -VsdxPath "C:\path\figure.vsdx" `
  -ExportFormats svg,pdf,pptx `
  -OutputDir "C:\path\exports" `
  -InspectPackage

For rebuild plus multi-format export, run:

powershell -ExecutionPolicy Bypass -File scripts\visio_rebuild_scaffold.ps1 `
  -VsdxPath "C:\path\figure.vsdx" `
  -PageW 16 `
  -PageH 9 `
  -RefW 1600 `
  -RefH 900 `
  -PreviewPath "C:\path\exports\figure.png" `
  -ExportFormats svg,pdf,pptx `
  -OutputDir "C:\path\exports"

For fast Chinese technical-bid flowchart rebuilds, save .vsdx only by omitting -PreviewPath and -ExportFormats:

powershell -ExecutionPolicy Bypass -File scripts\visio_rebuild_scaffold.ps1 `
  -VsdxPath "C:\path\outputs\1.vsdx" `
  -PageW 9.25 `
  -PageH 6.49 `
  -RefW 640 `
  -RefH 400

Safety Checklist

Acceptance Criteria

A Visio rebuild is acceptable only when:

Useful Resource

Use scripts/visio_page_tools.ps1 for common inspection, backup, preview export, multi-format export, and package checks. Use scripts/visio_export_formats.ps1 when a custom task script needs reusable export helpers. Use scripts/visio_rebuild_scaffold.ps1 as the starting point for native-shape drawing scripts; it includes both global top-left helpers and panel-local calibrated helpers. Read references/rebuild-guidelines.md when a task requires a full figure reconstruction or careful one-to-one scientific diagram matching.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.