#!/usr/bin/env python3
"""Render a STEP to an isometric PNG at a given up-axis, reusing the canonical
V3d offscreen renderer in service-step2glb. Thin wrapper so chip-fetcher can
render an arbitrary STEP (e.g. the name-embossed one) the same way the dashboard
thumbnails are produced.

  render-iso.py <in.step> <out.png> <up_axis> [size]

Run under xvfb-run (the V3d renderer needs an X display).
"""
import sys

sys.path.insert(0, "/home/adom/project/service-step2glb/api")
from step_to_thumbnail import render_thumbnail  # noqa: E402


def main():
    step, out = sys.argv[1], sys.argv[2]
    axis = sys.argv[3] if len(sys.argv) > 3 else "z"
    size = int(sys.argv[4]) if len(sys.argv) > 4 else 600
    render_thumbnail(step, out, pose="iso", up_axis=axis, width=size, height=size)
    print(f"OK: iso → {out}")


if __name__ == "__main__":
    main()