Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

1.3 KB
Raw Blame
"""Sample the captured local SVG profiles into Blender's retained outline input.

Authoring-only dependency: Playwright with Chromium. No website or API is used.
"""

import json
from pathlib import Path

from playwright.sync_api import sync_playwright

source = Path(__file__).resolve().parents[2] / "art/studies/agent-symbol-companions/source"
shapes = json.loads((source / "shapes.json").read_text(encoding="utf-8"))
with sync_playwright() as playwright:
    browser = playwright.chromium.launch(headless=True)
    page = browser.new_page()
    outlines = {}
    for name, markup in shapes.items():
        page.set_content(markup)
        outline = page.locator("[data-agent-body] > :first-child")
        if outline.count() == 0:
            # Retained authoring captures predate the animated SVG grouping.
            outline = page.locator("svg > :first-child")
        outlines[name] = outline.evaluate(
            """e => {
                const length = e.getTotalLength();
                return Array.from({length:96}, (_,i) => {
                    const p = e.getPointAtLength(length*i/96);
                    return [Number(p.x.toFixed(5)),Number(p.y.toFixed(5))];
                });
            }"""
        )
    browser.close()
(source / "outlines.json").write_text(
    json.dumps(outlines, separators=(",", ":")) + "\n", encoding="utf-8"
)