Loading...
Loading...
Create patent-style technical diagrams including flowcharts, block diagrams, and system architectures using Graphviz with reference numbering
npx skill4agent add robthepcguy/claude-patent-creator patent-diagram-generatorchoco install graphvizsudo apt install graphvizbrew install graphvizpip install graphvizimport sys
sys.path.insert(0, os.path.join(os.environ.get('CLAUDE_PLUGIN_ROOT', '.'), 'python'))
from python.diagram_generator import PatentDiagramGenerator
generator = PatentDiagramGenerator()steps = [
{"id": "start", "label": "Start", "shape": "ellipse", "next": ["step1"]},
{"id": "step1", "label": "Initialize System", "shape": "box", "next": ["decision"]},
{"id": "decision", "label": "Is Valid?", "shape": "diamond", "next": ["step2", "error"]},
{"id": "step2", "label": "Process Data", "shape": "box", "next": ["end"]},
{"id": "error", "label": "Handle Error", "shape": "box", "next": ["end"]},
{"id": "end", "label": "End", "shape": "ellipse", "next": []}
]
diagram_path = generator.create_flowchart(
steps=steps,
filename="method_flowchart",
output_format="svg"
)blocks = [
{"id": "input", "label": "Input\\nSensor", "type": "input"},
{"id": "cpu", "label": "Central\\nProcessor", "type": "process"},
{"id": "memory", "label": "Memory\\nStorage", "type": "storage"},
{"id": "output", "label": "Output\\nDisplay", "type": "output"}
]
connections = [
["input", "cpu", "raw data"],
["cpu", "memory", "store"],
["memory", "cpu", "retrieve"],
["cpu", "output", "processed data"]
]
diagram_path = generator.create_block_diagram(
blocks=blocks,
connections=connections,
filename="system_diagram",
output_format="svg"
)dot_code = """
digraph PatentSystem {
rankdir=LR;
node [shape=box, style=rounded];
Input [label="User Input\\n(10)"];
Processor [label="Processing Unit\\n(20)"];
Output [label="Display\\n(30)"];
Input -> Processor [label="data"];
Processor -> Output [label="result"];
}
"""
diagram_path = generator.render_dot_diagram(
dot_code=dot_code,
filename="custom_diagram",
output_format="svg",
engine="dot"
)# After creating a diagram, add patent-style reference numbers
reference_map = {
"Input Sensor": 10,
"Central Processor": 20,
"Memory Storage": 30,
"Output Display": 40
}
annotated_path = generator.add_reference_numbers(
svg_path=diagram_path,
reference_map=reference_map
)templates = generator.get_diagram_templates()
# Available templates:
# - simple_flowchart: Basic process flow
# - system_block: System architecture
# - method_steps: Sequential method
# - component_hierarchy: Hierarchical structureellipseboxdiamondparallelogramcylinderinputoutputprocessstoragedecisiondefaultdotneatofdpcircotwopisvgpngpdf"Input Sensor (10)"
" - Detector Element (12)"
" - Signal Processor (14)"
"Central Unit (20)"
" - CPU Core (22)"
" - Cache (24)"Reference Numbers:
- Input Module (10)
- Processing Unit (20)
- Output Interface (30)dot -Vpip show graphvizpython scripts/test_diagrams.py