More annotation added to the program
This commit is contained in:
@@ -24,12 +24,16 @@ def create_routed_layout_svg(
|
||||
|
||||
layout = yaml.safe_load(yaml_content) or {}
|
||||
cell_name = str(layout.get("name") or "layout")
|
||||
# mxpic_router is kept as a sibling repository, so the backend adds it to
|
||||
# sys.path only when the local checkout is available.
|
||||
router_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "mxpic_router"))
|
||||
if os.path.isdir(router_root) and router_root not in sys.path:
|
||||
sys.path.insert(0, router_root)
|
||||
from mxpic_router import build_project_gds
|
||||
|
||||
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
||||
# Build into a temporary GDS first, then convert the generated top cell into
|
||||
# the SVG preview consumed by the canvas.
|
||||
with tempfile.TemporaryDirectory(prefix="mxpic_routed_preview_") as temp_dir:
|
||||
temp_gds = os.path.join(temp_dir, f"{cell_name}.gds")
|
||||
build_project_gds(
|
||||
@@ -49,7 +53,10 @@ def create_routed_layout_svg(
|
||||
|
||||
|
||||
def layout_has_links(yaml_content: str) -> bool:
|
||||
"""Detect whether a layout YAML document contains routed bundle links."""
|
||||
layout = yaml.safe_load(yaml_content) or {}
|
||||
# Any bundle link means preview generation must use the routed builder
|
||||
# instead of simple component placement.
|
||||
for bundle in (layout.get("bundles") or {}).values():
|
||||
links = bundle.get("links") or []
|
||||
if links:
|
||||
|
||||
Reference in New Issue
Block a user