Demo

"""Demonstrate phiarchitect/orders shelf summary, Vignola parametric engine, and SVG export."""

        from __future__ import annotations

        import json
        from fractions import Fraction
        from pathlib import Path

        from phiarchitect.orders import (
            BUILDING_CROSSWALK,
            ClassicalOrder,
            export_order_spec,
            load_shelf,
            render_five_orders_svg,
        )


        def main() -> None:
            """Run the architectural orders demonstration and generate the elevation SVG plate."""
            shelf = load_shelf()
            print("=== Architectural Orders Shelf Summary ===")
            print(json.dumps(shelf.summary(), indent=2))

            print("\n=== Vignola (1562) Corinthian Spec (M = 300 mm) ===")
            print(json.dumps(export_order_spec(ClassicalOrder.CORINTHIAN, Fraction(300, 1)), indent=2))

            print(f"\n=== Building Classification Crosswalk ({len(BUILDING_CROSSWALK)} rows) ===")
            for row in BUILDING_CROSSWALK[:4]:
                print(
                    f"  {row.element_name}: {row.uniformat} <-> {row.ifc_class} "
                    f"<-> Holonica:{row.holonica_organ} <-> LCC:{row.lcc_call_class}"
                )

            repo_root = Path(__file__).resolve().parents[1]
            svg_path = repo_root / "docsrc" / "_static" / "images" / "vignola_five_orders.svg"
            svg_path.parent.mkdir(parents=True, exist_ok=True)
            svg_path.write_text(render_five_orders_svg(equal_module=True), encoding="utf-8")
            print(f"\nGenerated SVG plate: {svg_path}")


        if __name__ == "__main__":
            main()