Patent Flowchart Generation
Compliance Targets (patent drawings)
- Size: A4 @ 300DPI → 1890×2835 px (width×height).
- Color: strict grayscale/black/white. No colored lines, fills, or color bars.
- Typography: Songti/Heiti (simhei/simsun). Title ~11–13pt, box label ~8.5pt, sublabel ~6–7pt. All text absolute, not relative.
- Line thickness: rectangles 4–5px (
0.3mm), arrows 5–6px (0.35mm). No fine hairlines; no anti-aliasing artifacts after print scaling.
- Margins: 80–120px around the top title, 120px bottom margin for footer/notes.
Design Layouts
- Flow structure: 2-row × 4-column or 3-row × 4-column grid. Column count is 4 unless the workflow has fewer branches; do not use variable column counts — cap at 4.
- Box sizing: 340–420px width, 110–140px height. Gaps: X 56–70px, Y 90–100px.
- Title: Centered top, 90px from top edge.
- Footer: Optional 1-line patent disclaimer centered near bottom.
- Text truncation: titles ≤10 chars, sublabels ≤20 chars. Never let text overflow the box.
Arrow Rules (critical; multiple past failures)
- Horizontal arrows run at the vertical midline of the source box (
y + BOX_H//2), from right edge of column i to left edge of column i+1.
- Vertical arrows run at the horizontal center of a column (
col_x(c) + BOX_W//2), from bottom edge of the top box (y_top + BOX_H) to top edge of the bottom box (y_bottom).
- Arrowhead orientation:
x2 > x1 → right-pointing; x2 < x1 → left-pointing. Vertical: y2 > y1 → down-pointing.
- Arrow line width: 5–6px. Arrowhead size: ~12–14px half-width/height.
Source-Code → Flowchart Mapping
Workflow nodes are derived from the project source (e.g. main.py). Follow the actual function/module call hierarchy in the code, not an imagined workflow — one box per real, callable unit.
Canonical patterns
Fix the box labels for a given figure once, write them down, and reuse that list verbatim for every re-render. Do not invent new labels or reorder columns between iterations — see references/code-to-flowchart-mapping.md for how to derive the label list from code.
Outputs
fig*_300dpi.png per figure with embedded DPI metadata.
专利流程图_300DPI.pptx (WPS-compatible):
- 16:9 slide size (13.333" × 7.5").
- One slide per figure.
- Centered title textbox (bold, ~0.37–0.40 inches), image scaled ~90–94% of slide below it.
- Deliver on user Desktop under a dedicated folder (e.g.,
Desktop/patents_flows/).
Pitfalls
- Arrow offset: horizontal arrows must be at
row_y + BOX_H//2, not arbitrary Y. Vertical arrows must be at column center X, not left/right edges.
- Text overflow: labels truncated; do not blindly trust PIL text alignment.
- Color leakage: never use rainbow colormaps in flows. Pure (0,0,0) and (255,255,255).
- Reading PNGs back without vision_analyze: binary files can’t be viewed with text tools; use
vision_analyze when the user shares path to inspect layout quality.
References
references/patent-figure-spec.md — official regulation summary for Chinese patent drawings.
references/code-to-flowchart-mapping.md — deriving flowchart nodes, labels and branching patterns from a codebase.
references/patent-claim-audit.md — methodology for auditing patent claims against code, identifying gaps, and applying targeted patches to achieve full claim coverage.
1---2name: patent-flowchart-generation3description: Generate compliant patent flowchart images (A4@300DPI, black/white, no color) and assemble them into a WPS-compatible PPTX. Maps code logic into structured 2xN or 3xN grid flowcharts with precise arrows, bounded text, and formal layout.4---56# Patent Flowchart Generation78## Compliance Targets (patent drawings)9- **Size**: A4 @ 300DPI → **1890×2835 px** (width×height).10- **Color**: strict grayscale/black/white. No colored lines, fills, or color bars.11- **Typography**: Songti/Heiti (simhei/simsun). Title ~11–13pt, box label ~8.5pt, sublabel ~6–7pt. All text absolute, not relative.12- **Line thickness**: rectangles 4–5px (~0.3mm), arrows 5–6px (~0.35mm). No fine hairlines; no anti-aliasing artifacts after print scaling.13- **Margins**: 80–120px around the top title, 120px bottom margin for footer/notes.1415## Design Layouts16- **Flow structure**: 2-row × 4-column or 3-row × 4-column grid. Column count is 4 unless the workflow has fewer branches; do not use variable column counts — cap at 4.17- **Box sizing**: 340–420px width, 110–140px height. Gaps: X 56–70px, Y 90–100px.18- **Title**: Centered top, 90px from top edge.19- **Footer**: Optional 1-line patent disclaimer centered near bottom.20- **Text truncation**: titles ≤10 chars, sublabels ≤20 chars. Never let text overflow the box.2122## Arrow Rules (critical; multiple past failures)23- Horizontal arrows run at the **vertical midline** of the source box (`y + BOX_H//2`), from right edge of column `i` to left edge of column `i+1`.24- Vertical arrows run at the **horizontal center** of a column (`col_x(c) + BOX_W//2`), from bottom edge of the top box (`y_top + BOX_H`) to top edge of the bottom box (`y_bottom`).25- Arrowhead orientation: `x2 > x1` → right-pointing; `x2 < x1` → left-pointing. Vertical: `y2 > y1` → down-pointing.26- Arrow line width: 5–6px. Arrowhead size: ~12–14px half-width/height.2728## Source-Code → Flowchart Mapping29Workflow nodes are derived from the project source (e.g. `main.py`). Follow the actual function/module call hierarchy in the code, not an imagined workflow — one box per real, callable unit.3031## Canonical patterns32Fix the box labels for a given figure **once**, write them down, and reuse that list verbatim for every re-render. Do not invent new labels or reorder columns between iterations — see `references/code-to-flowchart-mapping.md` for how to derive the label list from code.3334## Outputs351. `fig*_300dpi.png` per figure with embedded DPI metadata.362. `专利流程图_300DPI.pptx` (WPS-compatible):37 - 16:9 slide size (13.333" × 7.5").38 - One slide per figure.39 - Centered title textbox (bold, ~0.37–0.40 inches), image scaled ~90–94% of slide below it.403. Deliver on user Desktop under a dedicated folder (e.g., `Desktop/patents_flows/`).4142## Pitfalls43- **Arrow offset**: horizontal arrows must be at `row_y + BOX_H//2`, not arbitrary Y. Vertical arrows must be at column center X, not left/right edges.44- **Text overflow**: labels truncated; do not blindly trust PIL text alignment.45- **Color leakage**: never use rainbow colormaps in flows. Pure (0,0,0) and (255,255,255).46- **Reading PNGs back without vision_analyze**: binary files can’t be viewed with text tools; use `vision_analyze` when the user shares path to inspect layout quality.4748## References49- `references/patent-figure-spec.md` — official regulation summary for Chinese patent drawings.50- `references/code-to-flowchart-mapping.md` — deriving flowchart nodes, labels and branching patterns from a codebase.51- `references/patent-claim-audit.md` — methodology for auditing patent claims against code, identifying gaps, and applying targeted patches to achieve full claim coverage.